Merge default to 0.9.19 0.9.19
authorunc0rr
Tue, 04 Jun 2013 00:20:06 +0400
branch0.9.19
changeset 9106 5ce3cfe45476
parent 9104 5cf87143b188 (current diff)
parent 9100 3f5e0280db4d (diff)
child 9108 83cc372c05d9
Merge default to 0.9.19
CMakeLists.txt
--- a/QTfrontend/hwform.cpp	Mon Jun 03 16:25:30 2013 +0200
+++ b/QTfrontend/hwform.cpp	Tue Jun 04 00:20:06 2013 +0400
@@ -1374,6 +1374,9 @@
     connect(ui.pageNetGame->pGameCFG, SIGNAL(paramChanged(const QString &, const QStringList &)), hwnet, SLOT(onParamChanged(const QString &, const QStringList &)));
     connect(hwnet, SIGNAL(configAsked()), ui.pageNetGame->pGameCFG, SLOT(fullNetConfig()));
 
+    // using proxy slot to prevent loss of game messages when they're sent to not yet connected slot of game object
+    connect(hwnet, SIGNAL(FromNet(const QByteArray &)), this, SLOT(FromNetProxySlot(const QByteArray &)), Qt::QueuedConnection);
+
     //nick and pass stuff
     hwnet->m_private_game = !(hostName == NETGAME_DEFAULT_SERVER && port == NETGAME_DEFAULT_PORT);
     if (hwnet->m_private_game == false && AskForNickAndPwd() != 0)
@@ -1726,6 +1729,11 @@
 
 void HWForm::CreateNetGame()
 {
+    // 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()
@@ -1736,7 +1744,6 @@
     connect(game, SIGNAL(SendNet(const QByteArray &)), hwnet, SLOT(SendNet(const QByteArray &)));
     connect(game, SIGNAL(SendChat(const QString &)), hwnet, SLOT(chatLineToNet(const QString &)));
     connect(game, SIGNAL(SendTeamMessage(const QString &)), hwnet, SLOT(SendTeamMessage(const QString &)));
-    connect(hwnet, SIGNAL(FromNet(const QByteArray &)), game, SLOT(FromNet(const QByteArray &)), Qt::QueuedConnection);
     connect(hwnet, SIGNAL(chatStringFromNet(const QString &)), game, SLOT(FromNetChat(const QString &)), Qt::QueuedConnection);
 
     game->StartNet();
@@ -1828,6 +1835,13 @@
     ui.pageNetGame->setMasterMode(false);
 }
 
+void HWForm::FromNetProxySlot(const QByteArray & msg)
+{
+    if(game)
+        game->FromNet(msg);
+
+}
+
 void HWForm::selectFirstNetScheme()
 {
     ui.pageNetGame->pGameCFG->GameSchemes->setCurrentIndex(0);
--- a/QTfrontend/hwform.h	Mon Jun 03 16:25:30 2013 +0200
+++ b/QTfrontend/hwform.h	Tue Jun 04 00:20:06 2013 +0400
@@ -145,6 +145,8 @@
         void startGame();
         void restartGame();
 
+        void FromNetProxySlot(const QByteArray &);
+
     private:
         void _NetConnect(const QString & hostName, quint16 port, QString nick);
         int  AskForNickAndPwd(void);