@@ -162,13 +162,7 @@ void DemoServer::handle_packet(AOPacket packet)
162162 load_demo (path);
163163 QString packet = " CT#DEMO#" + tr (" Demo file loaded. Send /play or > in OOC to begin playback." ) + " #1#%" ;
164164 client_sock->write (packet.toUtf8 ());
165- // Reset evidence list
166- client_sock->write (" LE##%" );
167- reset_all_timers ();
168- // Set the BG to default (also breaks up the message queue)
169- client_sock->write (" BN#default#wit#%" );
170- // Stop the wait packet timer
171- timer->stop ();
165+ reset_state ();
172166 }
173167 else if (contents[1 ].startsWith (" /play" ) || contents[1 ] == " >" )
174168 {
@@ -232,13 +226,7 @@ void DemoServer::handle_packet(AOPacket packet)
232226 load_demo (p_path);
233227 QString packet = " CT#DEMO#" + tr (" Current demo file reloaded. Send /play or > in OOC to begin playback." ) + " #1#%" ;
234228 client_sock->write (packet.toUtf8 ());
235- // Reset evidence list
236- client_sock->write (" LE##%" );
237- reset_all_timers ();
238- // Set the BG to default (also breaks up the message queue)
239- client_sock->write (" BN#default#wit#%" );
240- // Stop the wait packet timer
241- timer->stop ();
229+ reset_state ();
242230 }
243231 else if (contents[1 ].startsWith (" /min_wait" ))
244232 {
@@ -324,8 +312,12 @@ void DemoServer::load_demo(QString filename)
324312 }
325313}
326314
327- void DemoServer::reset_all_timers ()
315+ void DemoServer::reset_state ()
328316{
317+ // Reset evidence list
318+ client_sock->write (" LE##%" );
319+
320+ // Reset timers
329321 client_sock->write (" TI#0#3#0#%" );
330322 client_sock->write (" TI#0#1#0#%" );
331323 client_sock->write (" TI#1#1#0#%" );
@@ -336,6 +328,12 @@ void DemoServer::reset_all_timers()
336328 client_sock->write (" TI#3#3#0#%" );
337329 client_sock->write (" TI#4#1#0#%" );
338330 client_sock->write (" TI#4#3#0#%" );
331+
332+ // Set the BG to default (also breaks up the message queue)
333+ client_sock->write (" BN#default#wit#%" );
334+
335+ // Stop the wait packet timer
336+ timer->stop ();
339337}
340338
341339void DemoServer::playback ()
0 commit comments