--- a/QTfrontend/hwform.cpp Tue May 07 22:36:15 2019 +0200
+++ b/QTfrontend/hwform.cpp Fri May 10 22:51:43 2019 +0200
@@ -1366,6 +1366,7 @@
GoToPage(ID_PAGE_CONNECTING);
connect(hwnet, SIGNAL(AskForRunGame()), this, SLOT(CreateNetGame()), Qt::QueuedConnection);
+ connect(hwnet, SIGNAL(AskForOfficialServerDemo()), this, SLOT(PlayOfficialServerDemo()), Qt::QueuedConnection);
connect(hwnet, SIGNAL(redirected(quint16)), this, SLOT(NetRedirected(quint16)), Qt::QueuedConnection);
connect(hwnet, SIGNAL(connected()), this, SLOT(NetConnected()), Qt::QueuedConnection);
connect(hwnet, SIGNAL(Error(const QString&)), this, SLOT(NetError(const QString&)), Qt::QueuedConnection);
@@ -1926,6 +1927,23 @@
game->StartNet();
}
+void HWForm::PlayOfficialServerDemo()
+{
+ // go back in pages to prevent user from being stuck on certain pages
+ if(ui.Pages->currentIndex() == ID_PAGE_GAMESTATS ||
+ ui.Pages->currentIndex() == ID_PAGE_INGAME)
+ GoBack();
+
+ QString ammo;
+ ammo = ui.pageNetGame->pGameCFG->WeaponsName->itemData(
+ ui.pageNetGame->pGameCFG->WeaponsName->currentIndex()
+ ).toString();
+
+ CreateGame(ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget, ammo);
+
+ game->PlayOfficialServerDemo();
+}
+
void HWForm::closeEvent(QCloseEvent *event)
{
config->SaveOptions();