QTfrontend/game.cpp
branchflibqtfrontend
changeset 8092 08960209db8c
parent 8070 66bc20d089fc
child 8100 0e6fadf81a2c
--- a/QTfrontend/game.cpp	Thu Nov 22 00:56:36 2012 +0400
+++ b/QTfrontend/game.cpp	Thu Nov 22 01:19:16 2012 +0400
@@ -37,7 +37,7 @@
 QString training, campaign, campaignScript, campaignTeam; // TODO: Cleaner solution?
 
 HWGame::HWGame(GameUIConfig * config, GameCFGWidget * gamecfg, QString ammo, TeamSelWidget* pTeamSelWidget) :
-    TCPBase(true, 0),
+    TCPBase(0),
     ammostr(ammo),
     m_pTeamSelWidget(pTeamSelWidget)
 {
@@ -52,7 +52,7 @@
 }
 
 void HWGame::onClientDisconnect()
-{
+{/*
     switch (gameType)
     {
         case gtDemo:
@@ -69,7 +69,7 @@
                 emit HaveRecord(rtDemo, demo);
             else
                 emit HaveRecord(rtNeither, demo);
-    }
+    }*/
     SetGameState(gsStopped);
 }
 
@@ -106,7 +106,7 @@
             ;
         }
     }
-    RawSendIPC(buf);
+    //RawSendIPC(buf);
 }
 
 void HWGame::SendConfig()
@@ -150,7 +150,7 @@
     HWProto::addStringToBuffer(teamscfg, QString("eammreinf %1").arg(cDefaultAmmoStore->mid(3 * cAmmoNumber, cAmmoNumber)));
     HWProto::addStringToBuffer(teamscfg, QString("eammstore"));
     HWProto::addStringToBuffer(teamscfg, QString("eammstore"));
-    RawSendIPC(teamscfg);
+    //RawSendIPC(teamscfg);
 }
 
 void HWGame::SendTrainingConfig()
@@ -160,7 +160,7 @@
     HWProto::addStringToBuffer(traincfg, "eseed " + QUuid::createUuid().toString());
     HWProto::addStringToBuffer(traincfg, "escript " + training);
 
-    RawSendIPC(traincfg);
+   //RawSendIPC(traincfg);
 }
 
 void HWGame::SendCampaignConfig()
@@ -171,7 +171,7 @@
 
     HWProto::addStringToBuffer(campaigncfg, "escript " + campaignScript);
 
-    RawSendIPC(campaigncfg);
+   // RawSendIPC(campaigncfg);
 }
 
 void HWGame::SendNetConfig()
@@ -185,7 +185,7 @@
     {
         case '?':
         {
-            SendIPC("!");
+            //SendIPC("!");
             break;
         }
         case 'C':
@@ -256,7 +256,7 @@
             emit SendChat(msgbody);
             QByteArray buf;
             HWProto::addStringToBuffer(buf, "s" + HWProto::formatChatMsg(config->netNick(), msgbody) + "\x20\x20");
-            demo.append(buf);
+            //demo.append(buf);
             break;
         }
         case 'b':
@@ -280,25 +280,25 @@
             {
                 emit SendNet(msg);
             }
-            demo.append(msg);
+            //demo.append(msg);
         }
     }
 }
 
 void HWGame::FromNet(const QByteArray & msg)
 {
-    RawSendIPC(msg);
+    //RawSendIPC(msg);
 }
 
 void HWGame::FromNetChat(const QString & msg)
 {
     QByteArray buf;
     HWProto::addStringToBuffer(buf, 's' + msg + "\x20\x20");
-    RawSendIPC(buf);
+    //RawSendIPC(buf);
 }
 
 void HWGame::onClientRead()
-{
+{/*
     quint8 msglen;
     quint32 bufsize;
     while (!readbuffer.isEmpty() && ((bufsize = readbuffer.size()) > 0) &&
@@ -307,7 +307,7 @@
         QByteArray msg = readbuffer.left(msglen + 1);
         readbuffer.remove(0, msglen + 1);
         ParseMessage(msg);
-    }
+    }*/
 }
 
 QStringList HWGame::getArguments()
@@ -318,7 +318,7 @@
     arguments << QString::number(resolution.width());
     arguments << QString::number(resolution.height());
     arguments << QString::number(config->bitDepth()); // bpp
-    arguments << QString("%1").arg(ipc_port);
+    //arguments << QString("%1").arg(ipc_port);
     arguments << (config->vid_Fullscreen() ? "1" : "0");
     arguments << (config->isSoundEnabled() ? "1" : "0");
     arguments << (config->isMusicEnabled() ? "1" : "0");
@@ -346,35 +346,35 @@
     }
 
     // read demo
-    toSendBuf = demofile.readAll();
+    //toSendBuf = demofile.readAll();
 
     // run engine
-    demo.clear();
-    Start(false);
+    //demo.clear();
+    start(false);
     SetGameState(gsStarted);
 }
 
 void HWGame::StartNet()
 {
     gameType = gtNet;
-    demo.clear();
-    Start(false);
+    //demo.clear();
+    start(false);
     SetGameState(gsStarted);
 }
 
 void HWGame::StartLocal()
 {
     gameType = gtLocal;
-    demo.clear();
-    Start(false);
+    //demo.clear();
+    start(false);
     SetGameState(gsStarted);
 }
 
 void HWGame::StartQuick()
 {
     gameType = gtQLocal;
-    demo.clear();
-    Start(false);
+    //demo.clear();
+    start(false);
     SetGameState(gsStarted);
 }
 
@@ -382,8 +382,8 @@
 {
     gameType = gtTraining;
     training = "Missions/Training/" + file + ".lua";
-    demo.clear();
-    Start(false);
+    //demo.clear();
+    start(false);
     SetGameState(gsStarted);
 }
 
@@ -393,8 +393,8 @@
     campaign = camp;
     campaignScript = "Missions/Campaign/" + camp + "/" + campScript;
     campaignTeam = campTeam;
-    demo.clear();
-    Start(false);
+    //demo.clear();
+    start(false);
     SetGameState(gsStarted);
 }
 
@@ -412,7 +412,7 @@
 {
     QByteArray buf;
     HWProto::addStringToBuffer(buf, QString("efinish"));
-    RawSendIPC(buf);
+    //RawSendIPC(buf);
 }
 
 void HWGame::sendCampaignVar(const QByteArray &varToSend)
@@ -423,7 +423,7 @@
     QString varValue = teamfile.value("Campaign " + campaign + "/" + varToFind, "").toString();
     QByteArray command;
     HWProto::addStringToBuffer(command, "V." + varValue);
-    RawSendIPC(command);
+    //RawSendIPC(command);
 }
 
 void HWGame::writeCampaignVar(const QByteArray & varVal)
@@ -440,3 +440,7 @@
     teamfile.setValue("Campaign " + campaign + "/" + varToWrite, varValue);
 }
 
+void HWGame::onEngineStart()
+{
+
+}