QTfrontend/hwform.cpp
changeset 702 97858a6682bb
parent 697 44f167938201
child 703 424297e3165a
--- a/QTfrontend/hwform.cpp	Fri Jan 11 23:37:23 2008 +0000
+++ b/QTfrontend/hwform.cpp	Sat Jan 12 17:17:09 2008 +0000
@@ -125,14 +125,20 @@
 
 void HWForm::UpdateWeapons()
 {
-  ui.pageOptions->WeaponsName->clear();
-  ui.pageOptions->WeaponsName->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames());
+  // FIXME: rewrite this with boost (or TR1/0x)
+  QVector<QComboBox*> combos;
+  combos.push_back(ui.pageOptions->WeaponsName);
+  combos.push_back(ui.pageMultiplayer->gameCFG->WeaponsName);
+  combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName);
 
-  ui.pageMultiplayer->gameCFG->WeaponsName->clear();
-  ui.pageMultiplayer->gameCFG->WeaponsName->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames());
-
-  ui.pageNetGame->pGameCFG->WeaponsName->clear();
-  ui.pageNetGame->pGameCFG->WeaponsName->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames());
+  for(QVector<QComboBox*>::iterator it=combos.begin(); it!=combos.end(); ++it) {
+    (*it)->clear();
+    (*it)->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames());
+    int pos=(*it)->findText("Default");
+    if (pos!=-1) {
+      (*it)->setCurrentIndex(pos);
+    }
+  }
 }
 
 void HWForm::NetWeaponNameChanged(const QString& name)