--- a/QTfrontend/gamecfgwidget.cpp Sat Jan 12 17:17:09 2008 +0000
+++ b/QTfrontend/gamecfgwidget.cpp Sat Jan 12 22:41:03 2008 +0000
@@ -193,7 +193,12 @@
emit themeChanged(theme);
}
-void GameCFGWidget::setNetAmmo(const QString& ammo)
+void GameCFGWidget::setNetAmmo(const QString& name, const QString& ammo)
{
+ curNetAmmoName=name;
curNetAmmo=ammo;
+
+ WeaponsName->setEditable(false);
+ WeaponsName->clear();
+ WeaponsName->addItem(name);
}
--- a/QTfrontend/gamecfgwidget.h Sat Jan 12 17:17:09 2008 +0000
+++ b/QTfrontend/gamecfgwidget.h Sat Jan 12 22:41:03 2008 +0000
@@ -54,7 +54,7 @@
void setInitHealth(quint32 health);
void setTurnTime(quint32 time);
void setFortsMode(bool value);
- void setNetAmmo(const QString&);
+ void setNetAmmo(const QString& name, const QString& ammo);
signals:
void seedChanged(const QString & seed);
@@ -74,6 +74,7 @@
QLabel * L_TurnTime;
QLabel * L_InitHealth;
+ QString curNetAmmoName;
QString curNetAmmo;
private slots:
--- a/QTfrontend/hwform.cpp Sat Jan 12 17:17:09 2008 +0000
+++ b/QTfrontend/hwform.cpp Sat Jan 12 22:41:03 2008 +0000
@@ -144,7 +144,7 @@
void HWForm::NetWeaponNameChanged(const QString& name)
{
QString ammo=ui.pageSelectWeapon->pWeapons->getWeaponsString(ui.pageNetGame->pGameCFG->WeaponsName->currentText());
- hwnet->onWeaponsNameChanged(ammo);
+ hwnet->onWeaponsNameChanged(name, ammo);
}
void HWForm::UpdateTeamsLists(const QStringList* editable_teams)
@@ -428,7 +428,7 @@
ui.pageNetGame->pNetTeamsWidget, SLOT(changeHHNum(const HWTeam&)));
connect(hwnet, SIGNAL(teamColorChanged(const HWTeam&)),
ui.pageNetGame->pNetTeamsWidget, SLOT(changeTeamColor(const HWTeam&)));
- connect(hwnet, SIGNAL(ammoChanged(const QString&)), ui.pageNetGame->pGameCFG, SLOT(setNetAmmo(const QString&)));
+ connect(hwnet, SIGNAL(ammoChanged(const QString&, const QString&)), ui.pageNetGame->pGameCFG, SLOT(setNetAmmo(const QString&, const QString&)));
hwnet->Connect(hostName, port, nick);
}
--- a/QTfrontend/newnetclient.cpp Sat Jan 12 17:17:09 2008 +0000
+++ b/QTfrontend/newnetclient.cpp Sat Jan 12 22:41:03 2008 +0000
@@ -284,7 +284,8 @@
return;
}
if (lst[1] == "AMMO") {
- emit ammoChanged(lst[2]);
+ if(lst.size() < 4) return;
+ emit ammoChanged(lst[3], lst[2]);
return;
}
QStringList hhTmpList=lst[1].split('+');
@@ -340,7 +341,7 @@
onTurnTimeChanged(m_pGameCFGWidget->getTurnTime());
onFortsModeChanged(m_pGameCFGWidget->getGameFlags() & 0x1);
// always initialize with default ammo (also avoiding complicated cross-class dependencies)
- onWeaponsNameChanged(cDefaultAmmoStore->mid(10));
+ onWeaponsNameChanged("Default", cDefaultAmmoStore->mid(10));
}
void HWNewNet::RunGame()
@@ -392,9 +393,9 @@
RawSendNet(QString("CONFIG_PARAM%1FORTSMODE%1%2").arg(delimeter).arg(value));
}
-void HWNewNet::onWeaponsNameChanged(const QString& ammo)
+void HWNewNet::onWeaponsNameChanged(const QString& name, const QString& ammo)
{
- RawSendNet(QString("CONFIG_PARAM%1AMMO%1%2").arg(delimeter).arg(ammo));
+ RawSendNet(QString("CONFIG_PARAM%1AMMO%1%2%1%3").arg(delimeter).arg(ammo).arg(name));
}
void HWNewNet::chatLineToNet(const QString& str)
--- a/QTfrontend/newnetclient.h Sat Jan 12 17:17:09 2008 +0000
+++ b/QTfrontend/newnetclient.h Sat Jan 12 22:41:03 2008 +0000
@@ -102,7 +102,7 @@
void hhnumChanged(const HWTeam&);
void teamColorChanged(const HWTeam&);
void chatStringFromNet(const QStringList&);
- void ammoChanged(const QString&);
+ void ammoChanged(const QString& name, const QString& ammo);
public slots:
void chatLineToNet(const QString& str);
@@ -117,7 +117,7 @@
void onFortsModeChanged(bool value);
void onHedgehogsNumChanged(const HWTeam& team);
void onTeamColorChanged(const HWTeam& team);
- void onWeaponsNameChanged(const QString& ammo);
+ void onWeaponsNameChanged(const QString& name, const QString& ammo);
private slots:
void ClientRead();