浏览代码

Using different algo in GameTimeController movingobjects iteration.

_DS_ 15 年之前
父节点
当前提交
ba71869cbc
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      L2_GameServer/java/com/l2jserver/gameserver/GameTimeController.java

+ 4 - 3
L2_GameServer/java/com/l2jserver/gameserver/GameTimeController.java

@@ -15,6 +15,7 @@
 package com.l2jserver.gameserver;
 package com.l2jserver.gameserver;
 
 
 import java.util.Iterator;
 import java.util.Iterator;
+import java.util.Map;
 import java.util.logging.Logger;
 import java.util.logging.Logger;
 
 
 import javolution.util.FastMap;
 import javolution.util.FastMap;
@@ -112,16 +113,16 @@ public class GameTimeController
 	protected void moveObjects()
 	protected void moveObjects()
 	{
 	{
 		// Go throw the table containing L2Character in movement
 		// Go throw the table containing L2Character in movement
-		Iterator<L2Character> it = _movingObjects.values().iterator();
+		Iterator<Map.Entry<Integer, L2Character>> it = _movingObjects.entrySet().iterator();
 		while (it.hasNext())
 		while (it.hasNext())
 		{
 		{
 			// If movement is finished, the L2Character is removed from
 			// If movement is finished, the L2Character is removed from
 			// movingObjects and added to the ArrayList ended
 			// movingObjects and added to the ArrayList ended
-			L2Character ch = it.next();
+			L2Character ch = it.next().getValue();
 			if (ch.updatePosition(_gameTicks))
 			if (ch.updatePosition(_gameTicks))
 			{
 			{
-				ThreadPoolManager.getInstance().executeTask(new MovingObjectArrived(ch));
 				it.remove();
 				it.remove();
+				ThreadPoolManager.getInstance().executeTask(new MovingObjectArrived(ch));
 			}
 			}
 		}
 		}
 	}
 	}