summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-12 17:09:35 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-12 17:20:23 +0300
commit00d092dc0f458a3967f26e82655212db1b0bcc59 (patch)
tree91e25c9ad7e039e8839c05d87ba463682672be5c
parenta99b870ef80206eb58fb1b03dd64e8d0990ee268 (diff)
downloadmanaplus-00d092dc0f458a3967f26e82655212db1b0bcc59.tar.gz
manaplus-00d092dc0f458a3967f26e82655212db1b0bcc59.tar.bz2
manaplus-00d092dc0f458a3967f26e82655212db1b0bcc59.tar.xz
manaplus-00d092dc0f458a3967f26e82655212db1b0bcc59.zip
Fix possible infinite loop, also bit improve speed.
-rw-r--r--src/client.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/client.cpp b/src/client.cpp
index a7825a835..ed3656ee0 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -864,7 +864,8 @@ int Client::gameExec()
if (Net::getGeneralHandler())
Net::getGeneralHandler()->flushNetwork();
- while (get_elapsed_time(lastTickTime) > 0)
+ int k = 0;
+ while (lastTickTime != tick_time && k < 2)
{
if (gui)
gui->logic();
@@ -874,6 +875,7 @@ int Client::gameExec()
sound.logic();
++lastTickTime;
+ k ++;
}
// This is done because at some point tick_time will wrap.