aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/demoserver.h1
-rw-r--r--src/demoserver.cpp38
2 files changed, 17 insertions, 22 deletions
diff --git a/include/demoserver.h b/include/demoserver.h
index 3dc645be..0d4f0e47 100644
--- a/include/demoserver.h
+++ b/include/demoserver.h
@@ -24,6 +24,7 @@ public:
private:
void handle_packet(AOPacket packet);
void load_demo(QString filename);
+ void reset_all_timers();
QTcpServer* tcp_server;
QTcpSocket* client_sock = nullptr;
diff --git a/src/demoserver.cpp b/src/demoserver.cpp
index 8b82d75c..b9721bf2 100644
--- a/src/demoserver.cpp
+++ b/src/demoserver.cpp
@@ -164,17 +164,7 @@ void DemoServer::handle_packet(AOPacket packet)
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#%");
+ reset_all_timers();
// Set the BG to default (also breaks up the message queue)
client_sock->write("BN#default#wit#%");
// Stop the wait packet timer
@@ -244,17 +234,7 @@ void DemoServer::handle_packet(AOPacket packet)
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#%");
+ reset_all_timers();
// Set the BG to default (also breaks up the message queue)
client_sock->write("BN#default#wit#%");
// Stop the wait packet timer
@@ -297,6 +277,20 @@ void DemoServer::load_demo(QString filename)
}
}
+void DemoServer::reset_all_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#%");
+}
+
void DemoServer::playback()
{
if (demo_data.isEmpty())