diff options
| author | Crystalwarrior <varsash@gmail.com> | 2021-04-20 15:08:24 +0300 |
|---|---|---|
| committer | Crystalwarrior <varsash@gmail.com> | 2021-04-20 15:08:24 +0300 |
| commit | 86b342badcbf15469fc827a7fbec5baf8be8fa30 (patch) | |
| tree | acc98810b0ea32a3a4ee2b51d4f8010bd582e2fd | |
| parent | 79d1abb48ecaa68940d5c72f34e67c9b97f25bfb (diff) | |
Reset timers, evidence list and background whenever /load or /reload is used
| -rw-r--r-- | src/demoserver.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/demoserver.cpp b/src/demoserver.cpp index 866f32df..8b82d75c 100644 --- a/src/demoserver.cpp +++ b/src/demoserver.cpp @@ -162,6 +162,23 @@ void DemoServer::handle_packet(AOPacket packet) load_demo(path); QString packet = "CT#DEMO#" + tr("Demo file loaded. Send /play or > in OOC to begin playback.") + "#1#%"; client_sock->write(packet.toUtf8()); + // Reset evidence list + client_sock->write("LE##%"); + // Reset timers + client_sock->write("TI#0#3#0#%"); + client_sock->write("TI#0#1#0#%"); + client_sock->write("TI#1#1#0#%"); + client_sock->write("TI#1#3#0#%"); + client_sock->write("TI#2#1#0#%"); + client_sock->write("TI#2#3#0#%"); + client_sock->write("TI#3#1#0#%"); + client_sock->write("TI#3#3#0#%"); + client_sock->write("TI#4#1#0#%"); + client_sock->write("TI#4#3#0#%"); + // Set the BG to default (also breaks up the message queue) + client_sock->write("BN#default#wit#%"); + // Stop the wait packet timer + timer->stop(); } else if (contents[1].startsWith("/play") || contents[1] == ">") { @@ -225,6 +242,23 @@ void DemoServer::handle_packet(AOPacket packet) load_demo(p_path); QString packet = "CT#DEMO#" + tr("Current demo file reloaded. Send /play or > in OOC to begin playback.") + "#1#%"; client_sock->write(packet.toUtf8()); + // Reset evidence list + client_sock->write("LE##%"); + // Reset timers + client_sock->write("TI#0#3#0#%"); + client_sock->write("TI#0#1#0#%"); + client_sock->write("TI#1#1#0#%"); + client_sock->write("TI#1#3#0#%"); + client_sock->write("TI#2#1#0#%"); + client_sock->write("TI#2#3#0#%"); + client_sock->write("TI#3#1#0#%"); + client_sock->write("TI#3#3#0#%"); + client_sock->write("TI#4#1#0#%"); + client_sock->write("TI#4#3#0#%"); + // Set the BG to default (also breaks up the message queue) + client_sock->write("BN#default#wit#%"); + // Stop the wait packet timer + timer->stop(); } else if (contents[1].startsWith("/min_wait")) { @@ -245,8 +279,11 @@ void DemoServer::load_demo(QString filename) demo_file.open(QIODevice::ReadOnly); if (!demo_file.isOpen()) return; + // Clear demo data demo_data.clear(); + // Set the demo filepath p_path = filename; + // Process the demo file QTextStream demo_stream(&demo_file); demo_stream.setCodec("UTF-8"); QString line = demo_stream.readLine(); |
