# HG changeset patch
# User unc0rr
# Date 1370290503 -14400
# Node ID 3f5e0280db4d28e480a015e0f54dc931902e249c
# Parent  cba0d21991230592f6b3079e7742ad23077217ae
Fix issue 652 and fix issue 645

diff -r cba0d2199123 -r 3f5e0280db4d QTfrontend/hwform.cpp
--- a/QTfrontend/hwform.cpp	Mon Jun 03 10:05:44 2013 +0200
+++ b/QTfrontend/hwform.cpp	Tue Jun 04 00:15:03 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);
diff -r cba0d2199123 -r 3f5e0280db4d QTfrontend/hwform.h
--- a/QTfrontend/hwform.h	Mon Jun 03 10:05:44 2013 +0200
+++ b/QTfrontend/hwform.h	Tue Jun 04 00:15:03 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);