QTfrontend/game.cpp
branch0.9.19
changeset 8924 13ac59499066
parent 8902 a94c074fd483
parent 8901 505307b9735d
child 9080 9b42757d7e71
--- a/QTfrontend/game.cpp	Sat Apr 20 02:17:53 2013 +0200
+++ b/QTfrontend/game.cpp	Sat Apr 20 02:20:15 2013 +0200
@@ -38,6 +38,13 @@
 #include <QTextStream>
 #include "ThemeModel.h"
 
+// last game info
+QList<QVariant> lastGameStartArgs = QList<QVariant>();
+GameType lastGameType = gtNone;
+GameCFGWidget * lastGameCfg = NULL;
+QString lastGameAmmo = NULL;
+TeamSelWidget * lastGameTeamSel = NULL;
+
 QString training, campaign, campaignScript, campaignTeam; // TODO: Cleaner solution?
 
 HWGame::HWGame(GameUIConfig * config, GameCFGWidget * gamecfg, QString ammo, TeamSelWidget* pTeamSelWidget) :
@@ -48,6 +55,10 @@
     this->config = config;
     this->gamecfg = gamecfg;
     netSuspend = false;
+
+    lastGameCfg = gamecfg;
+    lastGameAmmo = ammo;
+    lastGameTeamSel = pTeamSelWidget;
 }
 
 HWGame::~HWGame()
@@ -228,6 +239,7 @@
                     SendQuickConfig();
                     break;
                 }
+                case gtNone:
                 case gtSave:
                 case gtDemo:
                     break;
@@ -343,7 +355,7 @@
         readbuffer.remove(0, msglen + 1);
         ParseMessage(msg);
     }
-    
+
     flushNetBuffer();
 }
 
@@ -352,7 +364,7 @@
     if(m_netSendBuffer.size())
     {
         emit SendNet(m_netSendBuffer);
-        
+
         m_netSendBuffer.clear();
     }
 }
@@ -435,6 +447,9 @@
 
 void HWGame::StartLocal()
 {
+    lastGameStartArgs.clear();
+    lastGameType = gtLocal;
+
     gameType = gtLocal;
     demo.clear();
     Start(false);
@@ -443,6 +458,9 @@
 
 void HWGame::StartQuick()
 {
+    lastGameStartArgs.clear();
+    lastGameType = gtQLocal;
+
     gameType = gtQLocal;
     demo.clear();
     Start(false);
@@ -451,6 +469,10 @@
 
 void HWGame::StartTraining(const QString & file)
 {
+    lastGameStartArgs.clear();
+    lastGameStartArgs.append(file);
+    lastGameType = gtTraining;
+
     gameType = gtTraining;
     training = "Missions/Training/" + file + ".lua";
     demo.clear();
@@ -460,6 +482,12 @@
 
 void HWGame::StartCampaign(const QString & camp, const QString & campScript, const QString & campTeam)
 {
+    lastGameStartArgs.clear();
+    lastGameStartArgs.append(camp);
+    lastGameStartArgs.append(campScript);
+    lastGameStartArgs.append(campTeam);
+    lastGameType = gtCampaign;
+
     gameType = gtCampaign;
     campaign = camp;
     campaignScript = "Missions/Campaign/" + camp + "/" + campScript;