Index: /root/workspace/L2_GameServer_c4/java/net/sf/l2j/gameserver/GameTimeController.java
===================================================================
--- /root/workspace/L2_GameServer_c4/java/net/sf/l2j/gameserver/GameTimeController.java (revision 2136)
+++ /root/workspace/L2_GameServer_c4/java/net/sf/l2j/gameserver/GameTimeController.java (working copy)
@@ -179,10 +179,16 @@
{
int _oldTicks=_gameTicks; // save old ticks value to avoid moving objects 2x in same tick
long runtime = System.currentTimeMillis() - _gameStartTime; // from server boot to now
+ int _newTicks;
+ for (;;) {
+ _newTicks = (int) (runtime / MILLIS_IN_TICK);
+ if (_oldTicks != _newTicks) {
+ _gameTicks = _newTicks;
+ break;
+ }
+ }
- _gameTicks = (int) (runtime / MILLIS_IN_TICK); // new ticks value (ticks now)
-
- if (_oldTicks != _gameTicks) moveObjects(); // XXX: if this makes objects go slower, remove it
+ moveObjects(); // XXX: if this makes objects go slower, remove it
// but I think it can't make that effect. is it better to call moveObjects() twice in same
// tick to make-up for missed tick ? or is it better to ignore missed tick ?
// (will happen very rarely but it will happen ... on garbage collection definitely)
@@ -194,7 +200,7 @@
//_log.finest("TICK: "+_gameTicks);
- sleep(sleepTime); // hope other threads will have much more cpu time available now
+ sleep((int) (sleepTime * 0.95)); // hope other threads will have much more cpu time available now
// SelectorThread most of all
}
}