aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2021-04-21 01:04:45 -0500
committerGitHub <noreply@github.com>2021-04-21 01:04:45 -0500
commit3e4de5da62966b63dc553fd793cb6de3d2f48391 (patch)
tree63c311dea8f7719583c6b347b6cd03bcabfc3573 /src
parentfb4a5e0656cf1ad023b761139f30ecf3a584f56e (diff)
parent7b058d1401ddc1721304516f5cc7cdbdb15fee5d (diff)
Merge pull request #531 from AttorneyOnline/fix/broken-demos
Fix demo playback max_wait -1 incorrect behavior when non-IC is processed
Diffstat (limited to 'src')
-rw-r--r--src/demoserver.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/demoserver.cpp b/src/demoserver.cpp
index 764cf225..09741fd4 100644
--- a/src/demoserver.cpp
+++ b/src/demoserver.cpp
@@ -264,22 +264,26 @@ void DemoServer::playback()
if (current_packet.startsWith("MS#"))
elapsed_time = 0;
- while (!current_packet.startsWith("wait") && !demo_data.isEmpty()) {
+ while (!current_packet.startsWith("wait#")) {
client_sock->write(current_packet.toUtf8());
+ if (demo_data.isEmpty())
+ break;
current_packet = demo_data.dequeue();
}
if (!demo_data.isEmpty()) {
AOPacket wait_packet = AOPacket(current_packet);
int duration = wait_packet.get_contents().at(0).toInt();
- if (max_wait != -1 && duration + elapsed_time > max_wait) {
- duration = qMax(0, max_wait - elapsed_time);
- // Skip the difference on the timers
- emit skip_timers(wait_packet.get_contents().at(0).toInt() - duration);
- }
- else if (timer->interval() != 0 && duration + elapsed_time > timer->interval()) {
- duration = qMax(0, timer->interval() - elapsed_time);
+ if (max_wait != -1) {
+ if (duration + elapsed_time > max_wait) {
+ duration = qMax(0, max_wait - elapsed_time);
+ // Skip the difference on the timers
emit skip_timers(wait_packet.get_contents().at(0).toInt() - duration);
+ }
+ else if (timer->interval() != 0 && duration + elapsed_time > timer->interval()) {
+ duration = qMax(0, timer->interval() - elapsed_time);
+ emit skip_timers(wait_packet.get_contents().at(0).toInt() - duration);
+ }
}
elapsed_time += duration;
timer->start(duration);