QTfrontend/selectWeapon.cpp
changeset 1576 a02353129a41
parent 1509 34f7dd4efe84
child 1904 20348675b015
--- a/QTfrontend/selectWeapon.cpp	Sat Jan 03 19:01:24 2009 +0000
+++ b/QTfrontend/selectWeapon.cpp	Sat Jan 03 19:01:50 2009 +0000
@@ -75,9 +75,16 @@
 {
 	wconf = new QSettings(cfgdir->absolutePath() + "/weapons.ini", QSettings::IniFormat, this);
 
-	wconf->setValue("Default", cDefaultAmmoStore->mid(10));
+	wconf->setValue("Default", *cDefaultAmmoStore);
 
-	QString currentState = cDefaultAmmoStore->mid(10);
+	QStringList keys = wconf->allKeys();
+	for(int i = 0; i < keys.size(); i++)
+	{
+		if (wconf->value(keys[i]).toString().size() != cDefaultAmmoStore->size())
+			wconf->remove(keys[i]);
+	}
+
+	QString currentState = *cDefaultAmmoStore;
 
 	pLayout = new QGridLayout(this);
 	pLayout->setSpacing(1);
@@ -110,7 +117,7 @@
 
 void SelWeaponWidget::setDefault()
 {
-	setWeapons(cDefaultAmmoStore->mid(10));
+	setWeapons(*cDefaultAmmoStore);
 }
 
 void SelWeaponWidget::save()