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);
|
load_demo(path);
|
||||||
QString packet = "CT#DEMO#" + tr("Demo file loaded. Send /play or > in OOC to begin playback.") + "#1#%";
|
QString packet = "CT#DEMO#" + tr("Demo file loaded. Send /play or > in OOC to begin playback.") + "#1#%";
|
||||||
client_sock->write(packet.toUtf8());
|
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] == ">")
|
else if (contents[1].startsWith("/play") || contents[1] == ">")
|
||||||
{
|
{
|
||||||
@ -225,6 +242,23 @@ void DemoServer::handle_packet(AOPacket packet)
|
|||||||
load_demo(p_path);
|
load_demo(p_path);
|
||||||
QString packet = "CT#DEMO#" + tr("Current demo file reloaded. Send /play or > in OOC to begin playback.") + "#1#%";
|
QString packet = "CT#DEMO#" + tr("Current demo file reloaded. Send /play or > in OOC to begin playback.") + "#1#%";
|
||||||
client_sock->write(packet.toUtf8());
|
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"))
|
else if (contents[1].startsWith("/min_wait"))
|
||||||
{
|
{
|
||||||
@ -245,8 +279,11 @@ void DemoServer::load_demo(QString filename)
|
|||||||
demo_file.open(QIODevice::ReadOnly);
|
demo_file.open(QIODevice::ReadOnly);
|
||||||
if (!demo_file.isOpen())
|
if (!demo_file.isOpen())
|
||||||
return;
|
return;
|
||||||
|
// Clear demo data
|
||||||
demo_data.clear();
|
demo_data.clear();
|
||||||
|
// Set the demo filepath
|
||||||
p_path = filename;
|
p_path = filename;
|
||||||
|
// Process the demo file
|
||||||
QTextStream demo_stream(&demo_file);
|
QTextStream demo_stream(&demo_file);
|
||||||
demo_stream.setCodec("UTF-8");
|
demo_stream.setCodec("UTF-8");
|
||||||
QString line = demo_stream.readLine();
|
QString line = demo_stream.readLine();
|
||||||
|
Loading…
Reference in New Issue
Block a user