QTfrontend/game.cpp
branchwebgl
changeset 8833 c13ebed437cb
parent 8444 75db7bb8dce8
parent 8629 76a265f3967c
child 9127 e350500c4edb
--- a/QTfrontend/game.cpp	Wed Feb 20 02:21:58 2013 +0100
+++ b/QTfrontend/game.cpp	Tue Apr 02 21:00:57 2013 +0200
@@ -313,9 +313,8 @@
         default:
         {
             if (gameType == gtNet && !netSuspend)
-            {
-                emit SendNet(msg);
-            }
+                m_netSendBuffer.append(msg);
+
             demo.append(msg);
         }
     }
@@ -344,6 +343,18 @@
         readbuffer.remove(0, msglen + 1);
         ParseMessage(msg);
     }
+    
+    flushNetBuffer();
+}
+
+void HWGame::flushNetBuffer()
+{
+    if(m_netSendBuffer.size())
+    {
+        emit SendNet(m_netSendBuffer);
+        
+        m_netSendBuffer.clear();
+    }
 }
 
 QStringList HWGame::getArguments()
@@ -478,7 +489,7 @@
 void HWGame::sendCampaignVar(const QByteArray &varToSend)
 {
     QString varToFind(varToSend);
-    QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + campaignTeam + ".hwt", QSettings::IniFormat, 0);
+    QSettings teamfile(QString("physfs://Teams/%1.hwt").arg(campaignTeam), QSettings::IniFormat, 0);
     teamfile.setIniCodec("UTF-8");
     QString varValue = teamfile.value("Campaign " + campaign + "/" + varToFind, "").toString();
     QByteArray command;
@@ -495,7 +506,7 @@
     QString varToWrite = QString::fromUtf8(varVal.left(i));
     QString varValue = QString::fromUtf8(varVal.mid(i + 1));
 
-    QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + campaignTeam + ".hwt", QSettings::IniFormat, 0);
+    QSettings teamfile(QString("physfs://Teams/%1.hwt").arg(campaignTeam), QSettings::IniFormat, 0);
     teamfile.setIniCodec("UTF-8");
     teamfile.setValue("Campaign " + campaign + "/" + varToWrite, varValue);
 }