aboutsummaryrefslogtreecommitdiff
path: root/src/packet_distribution.cpp
diff options
context:
space:
mode:
authorCrystalwarrior <varsash@gmail.com>2020-08-25 12:21:10 +0300
committerCrystalwarrior <varsash@gmail.com>2020-08-25 12:21:10 +0300
commit7e9c5726e02a65023d9563f49e833525bf8f4bae (patch)
tree05bcd9b5972f73f0164e38cb7cacb21602a864c3 /src/packet_distribution.cpp
parentfebfbeafc11ecad57d6e9a06575c28f1b13da8da (diff)
Introduce the timer packet - "TI".
This timer will start the clock accounting for latency! Cool, right? Remove useless qDebug() for music looping
Diffstat (limited to 'src/packet_distribution.cpp')
-rw-r--r--src/packet_distribution.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp
index 9422cfdb..1f49719f 100644
--- a/src/packet_distribution.cpp
+++ b/src/packet_distribution.cpp
@@ -728,6 +728,17 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
f_contents.at(4) == "1",
f_contents.at(5) == "1");
}
+ else if (header == "TI") { // Timer packet
+ if (courtroom_constructed && f_contents.size() >= 1) {
+ qint64 resolution = f_contents.at(0).toInt();
+ qDebug() << "timer" << resolution << last_ping << resolution - last_ping;
+ resolution = resolution - last_ping;
+ if (resolution > 0)
+ w_courtroom->start_clock(resolution);
+ else
+ w_courtroom->stop_clock();
+ }
+ }
end: