move timer reset to its own method

This commit is contained in:
in1tiate 2021-04-22 23:46:55 -05:00
parent 86b342badc
commit 43340e8869
2 changed files with 17 additions and 22 deletions

View File

@ -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;

View File

@ -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())