Skip to content

Commit 040b9a2

Browse files
committed
dont always create the demo server
1 parent fcc9cfd commit 040b9a2

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/aoapplication.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void AOApplication::construct_lobby()
6262
{
6363
demo_server->deleteLater();
6464
}
65-
demo_server = new DemoServer(this);
65+
6666
w_lobby->show();
6767
}
6868

src/lobby.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,13 +433,19 @@ void Lobby::on_demo_clicked(QTreeWidgetItem *item, int column)
433433
return;
434434
}
435435

436+
if (ao_app->demo_server)
437+
{
438+
ao_app->demo_server->deleteLater();
439+
}
440+
ao_app->demo_server = new DemoServer(this);
441+
436442
QString l_filepath = (get_app_path() + "/logs/%1/%2").arg(item->data(0, Qt::DisplayRole).toString(), item->data(1, Qt::DisplayRole).toString());
437443
ao_app->demo_server->start_server();
438-
ServerInfo demo_server;
439-
demo_server.address = "127.0.0.1";
440-
demo_server.port = ao_app->demo_server->port();
444+
ServerInfo demo_server_connection;
445+
demo_server_connection.address = "127.0.0.1";
446+
demo_server_connection.port = ao_app->demo_server->port();
441447
ao_app->demo_server->set_demo_file(l_filepath);
442-
net_manager->connect_to_server(demo_server);
448+
net_manager->connect_to_server(demo_server_connection);
443449
}
444450

445451
void Lobby::onReloadThemeRequested()

0 commit comments

Comments
 (0)