QTfrontend/newnetclient.cpp
changeset 697 44f167938201
parent 660 7c155e849602
child 703 424297e3165a
--- a/QTfrontend/newnetclient.cpp	Wed Jan 09 21:22:22 2008 +0000
+++ b/QTfrontend/newnetclient.cpp	Fri Jan 11 21:45:24 2008 +0000
@@ -18,6 +18,7 @@
 
 #include <QMessageBox>
 
+#include "hwconsts.h"
 #include "newnetclient.h"
 #include "proto.h"
 #include "gameuiconfig.h"
@@ -282,6 +283,10 @@
 	  emit fortsModeChanged(lst[2].toInt() != 0);
 	  return;
   	}
+	if (lst[1] == "AMMO") {
+	  emit ammoChanged(lst[2]);
+	  return;
+	}
 	QStringList hhTmpList=lst[1].split('+');
   	if (hhTmpList[0] == "TEAM_COLOR") {
 	  HWTeam tmptm(hhTmpList[1], hhTmpList[2].toUInt());
@@ -334,6 +339,8 @@
   onInitHealthChanged(m_pGameCFGWidget->getInitHealth());
   onTurnTimeChanged(m_pGameCFGWidget->getTurnTime());
   onFortsModeChanged(m_pGameCFGWidget->getGameFlags() & 0x1);
+  // always initialize with default ammo (also avoiding complicated cross-class dependencies)
+  onWeaponsNameChanged(cDefaultAmmoStore->mid(10)); 
 }
 
 void HWNewNet::RunGame()
@@ -385,6 +392,11 @@
   RawSendNet(QString("CONFIG_PARAM%1FORTSMODE%1%2").arg(delimeter).arg(value));
 }
 
+void HWNewNet::onWeaponsNameChanged(const QString& ammo)
+{
+  RawSendNet(QString("CONFIG_PARAM%1AMMO%1%2").arg(delimeter).arg(ammo));
+}
+
 void HWNewNet::chatLineToNet(const QString& str)
 {
   if(str!="") {