From 510c0f4b17f24eb534d22654a41e9157c89a8211 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 21 Mar 2021 05:12:44 +0300 Subject: Add timer packets to demo playback (#494) When the demo skips by some number of seconds, the timer will also skip forward by that duration. Co-authored-by: in1tiate <32779090+in1tiate@users.noreply.github.com> Co-authored-by: oldmud0 --- src/demoserver.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/demoserver.cpp') diff --git a/src/demoserver.cpp b/src/demoserver.cpp index 75664659..88dfdb4b 100644 --- a/src/demoserver.cpp +++ b/src/demoserver.cpp @@ -259,8 +259,11 @@ void DemoServer::playback() AOPacket wait_packet = AOPacket(current_packet); int duration = wait_packet.get_contents().at(0).toInt(); - if (max_wait != -1 && duration + elapsed_time > max_wait) + 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); + } elapsed_time += duration; timer->start(duration); } -- cgit