Reset timers, evidence list and background whenever /load or /reload is used
This commit is contained in:
parent
79d1abb48e
commit
86b342badc
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user