Predefine some ammo schemes
authorunc0rr
Sun, 12 Apr 2009 15:30:41 +0000
changeset 1967 213d368a002f
parent 1966 31e449e1d9dd
child 1968 f32b18c5d495
Predefine some ammo schemes
QTfrontend/hwconsts.cpp.in
QTfrontend/hwconsts.h
QTfrontend/selectWeapon.cpp
--- a/QTfrontend/hwconsts.cpp.in	Sun Apr 12 15:24:08 2009 +0000
+++ b/QTfrontend/hwconsts.cpp.in	Sun Apr 12 15:30:41 2009 +0000
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2007, 2008 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2007-2009 Andrey Korotaev <unC0Rr@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -30,6 +30,13 @@
 QStringList * mapList;
 
 QString * cDefaultAmmoStore = new QString("939192942219912103223511100120100000");
+QList< QPair<QString, QString> > cDefaultAmmos =
+	QList< QPair<QString, QString> >()
+	<< qMakePair(QString("Default"), *cDefaultAmmoStore)
+	<< qMakePair(QString("Crazy"),     QString("999999999999999999999999999999999999"))
+	<< qMakePair(QString("Pro mode"),  QString("909000900000000000000900000000000000"))
+	<< qMakePair(QString("Shoppa"),    QString("000000990000000000000000000000000000"))
+	;
 
 QColor * color1 = new QColor(221,   0,   0);
 QColor * color2 = new QColor( 67, 118, 233);
--- a/QTfrontend/hwconsts.h	Sun Apr 12 15:24:08 2009 +0000
+++ b/QTfrontend/hwconsts.h	Sun Apr 12 15:30:41 2009 +0000
@@ -20,6 +20,7 @@
 #include <QDir>
 #include <QStringList>
 #include <QColor>
+#include <QPair>
 
 extern QString * cProtoVer;
 extern QString * cVersionString;
@@ -33,6 +34,7 @@
 extern QStringList * mapList;
 
 extern QString * cDefaultAmmoStore;
+extern QList< QPair<QString, QString> > cDefaultAmmos;
 
 extern QColor * color1;
 extern QColor * color2;
--- a/QTfrontend/selectWeapon.cpp	Sun Apr 12 15:24:08 2009 +0000
+++ b/QTfrontend/selectWeapon.cpp	Sun Apr 12 15:30:41 2009 +0000
@@ -75,7 +75,8 @@
 {
 	wconf = new QSettings(cfgdir->absolutePath() + "/weapons.ini", QSettings::IniFormat, this);
 
-	wconf->setValue("Default", *cDefaultAmmoStore);
+	for(int i = 0; i < cDefaultAmmos.size(); ++i)
+		wconf->setValue(cDefaultAmmos[i].first, cDefaultAmmos[i].second);
 
 	QStringList keys = wconf->allKeys();
 	for(int i = 0; i < keys.size(); i++)