All pastes #47431 Raw Edit

Someone

public text v1 · immutable
#47431 ·published 2006-03-29 12:00 UTC
rendered paste body
Index: C:/workspace/c4/java/net/sf/l2j/gameserver/GameTimeController.java
===================================================================
--- C:/workspace/c4/java/net/sf/l2j/gameserver/GameTimeController.java	(revision 1680)
+++ C:/workspace/c4/java/net/sf/l2j/gameserver/GameTimeController.java	(working copy)
@@ -54,7 +54,7 @@
 	
 	private static List<L2Character> movingObjects = new FastList<L2Character>(); 
 	
-	protected TimerThread _timer;
+	protected static TimerThread _timer;
 
 	/**
 	 * one ingame day is 240 real minutes
@@ -167,7 +167,7 @@
 		
 		public TimerThread()
 		{
-			super("TimerThread");
+			super("GameTimeController");
 			setDaemon(true);
 			setPriority(MAX_PRIORITY);
 			_stop = false;
@@ -177,11 +177,15 @@
 		public void run()
 		{
 			try {
+				int _oldTicks;
 				for (;;)
 				{
 					long runtime = System.currentTimeMillis() - _gameStartTime;
+					_oldTicks=_gameTicks;
 					_gameTicks = (int)(runtime / MILLIS_IN_TICK);
-					moveObjects();
+					if(_oldTicks!=_gameTicks) moveObjects(); 
+					else yield();
+					
 					runtime = System.currentTimeMillis() - _gameStartTime;
 					int sleepTime = 1 + MILLIS_IN_TICK - ((int)runtime) % MILLIS_IN_TICK; 
 					sleep( sleepTime );