* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
authorkoda
Tue, 03 May 2011 23:16:47 +0200
changeset 5200 7440fe992e73
parent 5199 5eae5da831e1
child 5201 7b9aa7aac336
* move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well) * increase the max team number from 6 to 8 like engine supports * update ios project file for uCursor
QTfrontend/hwconsts.cpp.in
QTfrontend/hwconsts.h
project_files/HedgewarsMobile/Classes/CreationChamber.m
project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj
--- a/QTfrontend/hwconsts.cpp.in	Mon May 02 18:40:15 2011 +0400
+++ b/QTfrontend/hwconsts.cpp.in	Tue May 03 23:16:47 2011 +0200
@@ -34,57 +34,35 @@
 bool custom_config = false;
 bool custom_data = false;
 
-int cMaxTeams = 6;
+int cMaxTeams = 8;
 int cMinServerVersion = 0;
 
-QString * cDefaultAmmoStore = new QString(
-        "939192942219912103223511100120100000021111010101111991"
-        "040504054160065554655446477657666666615551010111541111"
-        "000000000000020550000004000700400000000022000000060000"
-        "131111031211111112311411111111111111121111110111111111"
-        );
+QString * cDefaultAmmoStore = new QString( AMMOLINE_DEFAULT_QT AMMOLINE_DEFAULT_PROB
+                                           AMMOLINE_DEFAULT_DELAY AMMOLINE_DEFAULT_CRATE );
 int cAmmoNumber = cDefaultAmmoStore->size() / 4;
 
 QList< QPair<QString, QString> > cDefaultAmmos =
         QList< QPair<QString, QString> >()
         << qMakePair(QString("Default"), *cDefaultAmmoStore)
-        << qMakePair(QString("Crazy"),     QString(
-        // TODO: Remove Piano's unlimited uses!
-        "999999999999999999299999999999999929999999990999999229"
-        "111111011111111111111111111111111111111111110111111111"
-        "000000000000000000000000000000000000000000000000000000"
-        "131111031211111112311411111111111111121111010111111111"
-        ))
-        << qMakePair(QString("Pro Mode"),  QString(
-        "909000900000000000000900000000000000000000000000000000"
-        "000000000000000000000000000000000000000000000000000000"
-        "000000000000020550000004000700400000000020000000000000"
-        "111111111111111111111111111111111111111110010111111111"
-        ))
-        << qMakePair(QString("Shoppa"),    QString(
-        "000000990000000000000000000000000000000000000000000000"
-        "444441004424440221011212122242200000000200040001001111"
-        "000000000000000000000000000000000000000000000000000000"
-        "111111111111111111111111111111111111111110110111111111"
-        ))
-        << qMakePair(QString("Clean Slate"),QString(
-        "101000900001000001100000000000000000000000000000100000"
-        "040504054160065554655446477657666666615551010111541111"
-        "000000000000000000000000000000000000000000000000000000"
-        "131111031211111112311411111111111111121111110111111111"
-        ))
-        << qMakePair(QString("Minefield"), QString(
-        "000000990009000000030000000000000000000000000000000000"
-        "000000000000000000000000000000000000000000000000000000"
-        "000000000000020550000004000700400000000020000000060000"
-        "111111111111111111111111111111111111111111110111111111"
-        ))
+        << qMakePair(QString("Crazy"),       QString(
+            AMMOLINE_CRAZY_QT AMMOLINE_CRAZY_PROB
+            AMMOLINE_CRAZY_DELAY AMMOLINE_CRAZY_CRATE ))
+        << qMakePair(QString("Pro Mode"),    QString(
+            AMMOLINE_PROMODE_QT AMMOLINE_PROMODE_PROB
+            AMMOLINE_PROMODE_DELAY AMMOLINE_PROMODE_CRATE ))
+        << qMakePair(QString("Shoppa"),      QString(
+            AMMOLINE_SHOPPA_QT AMMOLINE_SHOPPA_PROB
+            AMMOLINE_SHOPPA_DELAY AMMOLINE_SHOPPA_CRATE ))
+        << qMakePair(QString("Clean Slate"), QString(
+            AMMOLINE_CLEAN_QT AMMOLINE_CLEAN_PROB
+            AMMOLINE_CLEAN_DELAY AMMOLINE_CLEAN_CRATE ))
+        << qMakePair(QString("Minefield"),   QString(
+            AMMOLINE_MINES_QT AMMOLINE_MINES_PROB
+            AMMOLINE_MINES_DELAY AMMOLINE_MINES_CRATE ))
         << qMakePair(QString("Thinking with Portals"), QString(
-        "900000900200000000210000000000000011000009000000000000"
-        "040504054160065554655446477657666666615551010111541111"
-        "000000000000020550000004000700400000000020000000060000"
-        "131111031211111112311411111111111111121111110111111111"
-        ));
+            AMMOLINE_PORTALS_QT AMMOLINE_PORTALS_PROB
+            AMMOLINE_PORTALS_DELAY AMMOLINE_PORTALS_CRATE ))
+        ;
 
 QColor *colors[] = {
                     new QColor(221,   0,   0), // classic red
--- a/QTfrontend/hwconsts.h	Mon May 02 18:40:15 2011 +0400
+++ b/QTfrontend/hwconsts.h	Tue May 03 23:16:47 2011 +0200
@@ -16,6 +16,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#if !defined(TARGET_OS_IPHONE)
 #include <QString>
 #include <QDir>
 #include <QStringList>
@@ -52,3 +53,41 @@
 
 extern bool haveServer;
 extern bool isDevBuild;
+#endif
+
+#define AMMOLINE_DEFAULT_QT     "939192942219912103223511100120100000021111010101111991"
+#define AMMOLINE_DEFAULT_PROB   "040504054160065554655446477657666666615551010111541111"
+#define AMMOLINE_DEFAULT_DELAY  "000000000000020550000004000700400000000022000000060000"
+#define AMMOLINE_DEFAULT_CRATE  "131111031211111112311411111111111111121111110111111111"
+
+//TODO: Remove Piano's unlimited uses!
+#define AMMOLINE_CRAZY_QT       "999999999999999999299999999999999929999999990999999229"
+#define AMMOLINE_CRAZY_PROB     "111111011111111111111111111111111111111111110111111111"
+#define AMMOLINE_CRAZY_DELAY    "000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_CRAZY_CRATE    "131111031211111112311411111111111111121111010111111111"
+
+#define AMMOLINE_PROMODE_QT     "909000900000000000000900000000000000000000000000000000"
+#define AMMOLINE_PROMODE_PROB   "000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_PROMODE_DELAY  "000000000000020550000004000700400000000020000000000000"
+#define AMMOLINE_PROMODE_CRATE  "111111111111111111111111111111111111111110010111111111"
+
+#define AMMOLINE_SHOPPA_QT      "000000990000000000000000000000000000000000000000000000"
+#define AMMOLINE_SHOPPA_PROB    "444441004424440221011212122242200000000200040001001111"
+#define AMMOLINE_SHOPPA_DELAY   "000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_SHOPPA_CRATE   "111111111111111111111111111111111111111110110111111111"
+
+#define AMMOLINE_CLEAN_QT       "101000900001000001100000000000000000000000000000100000"
+#define AMMOLINE_CLEAN_PROB     "040504054160065554655446477657666666615551010111541111"
+#define AMMOLINE_CLEAN_DELAY    "000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_CLEAN_CRATE    "131111031211111112311411111111111111121111110111111111"
+
+#define AMMOLINE_MINES_QT       "000000990009000000030000000000000000000000000000000000"
+#define AMMOLINE_MINES_PROB     "000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_MINES_DELAY    "000000000000020550000004000700400000000020000000060000"
+#define AMMOLINE_MINES_CRATE    "111111111111111111111111111111111111111111110111111111"
+
+#define AMMOLINE_PORTALS_QT     "900000900200000000210000000000000011000009000000000000"
+#define AMMOLINE_PORTALS_PROB   "040504054160065554655446477657666666615551010111541111"
+#define AMMOLINE_PORTALS_DELAY  "000000000000020550000004000700400000000020000000060000"
+#define AMMOLINE_PORTALS_CRATE  "131111031211111112311411111111111111121111110111111111"
+
--- a/project_files/HedgewarsMobile/Classes/CreationChamber.m	Mon May 02 18:40:15 2011 +0400
+++ b/project_files/HedgewarsMobile/Classes/CreationChamber.m	Tue May 03 23:16:47 2011 +0200
@@ -20,6 +20,8 @@
 
 
 #import "CreationChamber.h"
+#import "hwconsts.h"
+
 
 void createTeamNamed (NSString *nameWithoutExt) {
     NSString *teamsDirectory = TEAMS_DIRECTORY();
@@ -72,110 +74,61 @@
                                                         error:NULL];
     }
 
-    NSDictionary *theWeapon = nil;
+    NSInteger ammolineSize = HW_getNumberOfWeapons();
+    NSString *qt, *prob, *delay, *crate;
     switch (type) {
         default: //default
-            theWeapon = [[NSDictionary alloc] initWithObjects:
-                         [NSArray arrayWithObjects:
-                          @"93919294221991210322351110012010000002111101010111200",
-                          @"04050405416006555465544647765766666661555101011154100",
-                          @"00000000000002055000000400070040000000002000000006000",
-                          @"13111103121111111231141111111111111112111111011111200",
-                          nil]
-                                                      forKeys: [NSArray arrayWithObjects:
-                                                                @"ammostore_initialqt",
-                                                                @"ammostore_probability",
-                                                                @"ammostore_delay",
-                                                                @"ammostore_crate", nil]];
+            qt = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_QT length:ammolineSize encoding:NSUTF8StringEncoding];
+            prob = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_QT length:ammolineSize encoding:NSUTF8StringEncoding];
+            delay = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_QT length:ammolineSize encoding:NSUTF8StringEncoding];
+            crate = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_QT length:ammolineSize encoding:NSUTF8StringEncoding];
             break;
         case 1: //crazy
-            theWeapon = [[NSDictionary alloc] initWithObjects:
-                         [NSArray arrayWithObjects:
-                          @"99999999999999999929999999999999992999999999099999900",
-                          @"11111101111111111111111111111111111111111111011111100",
-                          @"00000000000000000000000000000000000000000000000000000",
-                          @"13111103121111111231141111111111111112111101011111100",
-                          nil]
-                                                      forKeys: [NSArray arrayWithObjects:
-                                                                @"ammostore_initialqt",
-                                                                @"ammostore_probability",
-                                                                @"ammostore_delay",
-                                                                @"ammostore_crate", nil]];
+            qt = [[NSString alloc] initWithBytes:AMMOLINE_CRAZY_QT length:ammolineSize encoding:NSUTF8StringEncoding];
+            prob = [[NSString alloc] initWithBytes:AMMOLINE_CRAZY_PROB length:ammolineSize encoding:NSUTF8StringEncoding];
+            delay = [[NSString alloc] initWithBytes:AMMOLINE_CRAZY_DELAY length:ammolineSize encoding:NSUTF8StringEncoding];
+            crate = [[NSString alloc] initWithBytes:AMMOLINE_CRAZY_CRATE length:ammolineSize encoding:NSUTF8StringEncoding];
             break;
         case 2: //pro mode
-            theWeapon = [[NSDictionary alloc] initWithObjects:
-                         [NSArray arrayWithObjects:
-                          @"90900090000000000000090000000000000000000000000000000",
-                          @"00000000000000000000000000000000000000000000000000000",
-                          @"00000000000002055000000400070040000000002000000000000",
-                          @"11111111111111111111111111111111111111111001011111100",
-                          nil]
-                                                      forKeys: [NSArray arrayWithObjects:
-                                                                @"ammostore_initialqt",
-                                                                @"ammostore_probability",
-                                                                @"ammostore_delay",
-                                                                @"ammostore_crate", nil]];
+            qt = [[NSString alloc] initWithBytes:AMMOLINE_PROMODE_QT length:ammolineSize encoding:NSUTF8StringEncoding];
+            prob = [[NSString alloc] initWithBytes:AMMOLINE_PROMODE_PROB length:ammolineSize encoding:NSUTF8StringEncoding];
+            delay = [[NSString alloc] initWithBytes:AMMOLINE_PROMODE_DELAY length:ammolineSize encoding:NSUTF8StringEncoding];
+            crate = [[NSString alloc] initWithBytes:AMMOLINE_PROMODE_CRATE length:ammolineSize encoding:NSUTF8StringEncoding];
             break;
         case 3: //shoppa
-            theWeapon = [[NSDictionary alloc] initWithObjects:
-                         [NSArray arrayWithObjects:
-                          @"00000099000000000000000000000000000000000000000000000",
-                          @"44444100442444022101121212224220000000020004000100100",
-                          @"00000000000000000000000000000000000000000000000000000",
-                          @"11111111111111111111111111111111111111111011011111100",
-                          nil]
-                                                      forKeys: [NSArray arrayWithObjects:
-                                                                @"ammostore_initialqt",
-                                                                @"ammostore_probability",
-                                                                @"ammostore_delay",
-                                                                @"ammostore_crate", nil]];
+            qt = [[NSString alloc] initWithBytes:AMMOLINE_SHOPPA_QT length:ammolineSize encoding:NSUTF8StringEncoding];
+            prob = [[NSString alloc] initWithBytes:AMMOLINE_SHOPPA_PROB length:ammolineSize encoding:NSUTF8StringEncoding];
+            delay = [[NSString alloc] initWithBytes:AMMOLINE_SHOPPA_DELAY length:ammolineSize encoding:NSUTF8StringEncoding];
+            crate = [[NSString alloc] initWithBytes:AMMOLINE_SHOPPA_CRATE length:ammolineSize encoding:NSUTF8StringEncoding];
             break;
         case 4: //clean slate
-            theWeapon = [[NSDictionary alloc] initWithObjects:
-                         [NSArray arrayWithObjects:
-                          @"10100090000100000110000000000000000000000000000010000",
-                          @"04050405416006555465544647765766666661555101011154100",
-                          @"00000000000000000000000000000000000000000000000000000",
-                          @"13111103121111111231141111111111111112111111011111100",
-                          nil]
-                                                      forKeys: [NSArray arrayWithObjects:
-                                                                @"ammostore_initialqt",
-                                                                @"ammostore_probability",
-                                                                @"ammostore_delay",
-                                                                @"ammostore_crate", nil]];
+            qt = [[NSString alloc] initWithBytes:AMMOLINE_CLEAN_QT length:ammolineSize encoding:NSUTF8StringEncoding];
+            prob = [[NSString alloc] initWithBytes:AMMOLINE_CLEAN_PROB length:ammolineSize encoding:NSUTF8StringEncoding];
+            delay = [[NSString alloc] initWithBytes:AMMOLINE_CLEAN_DELAY length:ammolineSize encoding:NSUTF8StringEncoding];
+            crate = [[NSString alloc] initWithBytes:AMMOLINE_CLEAN_CRATE length:ammolineSize encoding:NSUTF8StringEncoding];
             break;
         case 5: //minefield
-            theWeapon = [[NSDictionary alloc] initWithObjects:
-                         [NSArray arrayWithObjects:
-                          @"00000099000900000003000000000000000000000000000000000",
-                          @"00000000000000000000000000000000000000000000000000000",
-                          @"00000000000002055000000400070040000000002000000006000",
-                          @"11111111111111111111111111111111111111111111011111100",
-                          nil]
-                                                      forKeys: [NSArray arrayWithObjects:
-                                                                @"ammostore_initialqt",
-                                                                @"ammostore_probability",
-                                                                @"ammostore_delay",
-                                                                @"ammostore_crate", nil]];
+            qt = [[NSString alloc] initWithBytes:AMMOLINE_MINES_QT length:ammolineSize encoding:NSUTF8StringEncoding];
+            prob = [[NSString alloc] initWithBytes:AMMOLINE_MINES_PROB length:ammolineSize encoding:NSUTF8StringEncoding];
+            delay = [[NSString alloc] initWithBytes:AMMOLINE_MINES_DELAY length:ammolineSize encoding:NSUTF8StringEncoding];
+            crate = [[NSString alloc] initWithBytes:AMMOLINE_MINES_CRATE length:ammolineSize encoding:NSUTF8StringEncoding];
             break;
         case 6: //thinking with portals
-            theWeapon = [[NSDictionary alloc] initWithObjects:
-                         [NSArray arrayWithObjects:
-                          @"90000090020000000021000000000000001100000900000000000",
-                          @"04050405416006555465544647765766666661555101011154100",
-                          @"00000000000002055000000400070040000000002000000006000",
-                          @"13111103121111111231141111111111111112111111011111100",
-                          nil]
-                                                      forKeys: [NSArray arrayWithObjects:
-                                                                @"ammostore_initialqt",
-                                                                @"ammostore_probability",
-                                                                @"ammostore_delay",
-                                                                @"ammostore_crate", nil]];
+            qt = [[NSString alloc] initWithBytes:AMMOLINE_PORTALS_QT length:ammolineSize encoding:NSUTF8StringEncoding];
+            prob = [[NSString alloc] initWithBytes:AMMOLINE_PORTALS_PROB length:ammolineSize encoding:NSUTF8StringEncoding];
+            delay = [[NSString alloc] initWithBytes:AMMOLINE_PORTALS_DELAY length:ammolineSize encoding:NSUTF8StringEncoding];
+            crate = [[NSString alloc] initWithBytes:AMMOLINE_PORTALS_CRATE length:ammolineSize encoding:NSUTF8StringEncoding];
             break;
     }
 
+    NSDictionary *theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: qt,@"ammostore_initialqt",
+                               prob,@"ammostore_probability", delay,@"ammostore_delay", crate,@"ammostore_crate", nil];
+    [qt release];
+    [prob release];
+    [delay release];
+    [crate release];
+
     NSString *weaponFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", weaponsDirectory, nameWithoutExt];
-
     [theWeapon writeToFile:weaponFile atomically:YES];
     [weaponFile release];
     [theWeapon release];
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Mon May 02 18:40:15 2011 +0400
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Tue May 03 23:16:47 2011 +0200
@@ -179,6 +179,7 @@
 		61A670C012747D9B00B06CE7 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 6183D83D11E2BCE200A88903 /* Default.png */; };
 		61A670C112747DB900B06CE7 /* MainMenuViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924C11CA9CB400D6E256 /* MainMenuViewController-iPhone.xib */; };
 		61A670C212747DBD00B06CE7 /* MapConfigViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924E11CA9CB400D6E256 /* MapConfigViewController-iPhone.xib */; };
+		61A976B3136F668500DD9878 /* uCursor.pas in Sources */ = {isa = PBXBuildFile; fileRef = 61A976B2136F668500DD9878 /* uCursor.pas */; };
 		61AC067412B2E32D000B52A2 /* Appirater.m in Sources */ = {isa = PBXBuildFile; fileRef = 61AC067312B2E32D000B52A2 /* Appirater.m */; };
 		61B3D71C11EA6F2700EC7420 /* uKeys.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987FE114AA34C00BA94A9 /* uKeys.pas */; };
 		61B7A33812CC21080086B604 /* StatsPageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B7A33712CC21080086B604 /* StatsPageViewController.m */; };
@@ -511,6 +512,8 @@
 		61A4A39212A5CCC2004D81E6 /* uUtils.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uUtils.pas; path = ../../hedgewars/uUtils.pas; sourceTree = SOURCE_ROOT; };
 		61A4A39312A5CCC2004D81E6 /* uVariables.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uVariables.pas; path = ../../hedgewars/uVariables.pas; sourceTree = SOURCE_ROOT; };
 		61A4A3A112A5CD56004D81E6 /* uCaptions.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uCaptions.pas; path = ../../hedgewars/uCaptions.pas; sourceTree = SOURCE_ROOT; };
+		61A976B2136F668500DD9878 /* uCursor.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uCursor.pas; path = ../../hedgewars/uCursor.pas; sourceTree = SOURCE_ROOT; };
+		61A97F0E136F675A00DD9878 /* hwconsts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hwconsts.h; path = ../../QTfrontend/hwconsts.h; sourceTree = SOURCE_ROOT; };
 		61AC067212B2E32D000B52A2 /* Appirater.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Appirater.h; path = Classes/Appirater.h; sourceTree = "<group>"; };
 		61AC067312B2E32D000B52A2 /* Appirater.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Appirater.m; path = Classes/Appirater.m; sourceTree = "<group>"; };
 		61B7A33612CC21080086B604 /* StatsPageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatsPageViewController.h; sourceTree = "<group>"; };
@@ -645,6 +648,7 @@
 				6165929D11CA9E2F00D6E256 /* HedgewarsAppDelegate.m */,
 				61DE91561258B76800B80214 /* Custom UIs */,
 				32CA4F630368D1EE00C91783 /* Hedgewars_Prefix.pch */,
+				61A97F0E136F675A00DD9878 /* hwconsts.h */,
 				6165922911CA9BD500D6E256 /* PascalImports.h */,
 				61D2059F127CDD1100ABD83E /* ObjcExports.h */,
 				61D205A0127CDD1100ABD83E /* ObjcExports.m */,
@@ -1004,6 +1008,7 @@
 		9283015C0F10E48900CC5A3C /* Pascal Sources */ = {
 			isa = PBXGroup;
 			children = (
+				61A976B2136F668500DD9878 /* uCursor.pas */,
 				61E5D68C12AB006F00566F29 /* uLandPainted.pas */,
 				61A4A3A112A5CD56004D81E6 /* uCaptions.pas */,
 				61A4A38912A5CCC2004D81E6 /* uCommandHandlers.pas */,
@@ -1469,6 +1474,7 @@
 				61E2E12E12BAAEE30051B659 /* ServerSetup.m in Sources */,
 				61B7A33812CC21080086B604 /* StatsPageViewController.m in Sources */,
 				61EDB5B0135B3F97009B29A6 /* GameInterfaceBridge.m in Sources */,
+				61A976B3136F668500DD9878 /* uCursor.pas in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};