disable large maps also on iphone3gs and ipodtouch3g, they fail to load sometimes
authorkoda
Sat, 11 Dec 2010 02:30:03 +0100
changeset 4505 4a8f87eb67cb
parent 4504 8906b2409d97
child 4506 37744d5c877e
disable large maps also on iphone3gs and ipodtouch3g, they fail to load sometimes
project_files/HedgewarsMobile/Classes/CommodityFunctions.h
project_files/HedgewarsMobile/Classes/MapConfigViewController.m
project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Sat Dec 11 01:55:16 2010 +0100
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Sat Dec 11 02:30:03 2010 +0100
@@ -58,6 +58,7 @@
 #define IS_DUALHEAD()           ([[UIScreen class] respondsToSelector:@selector(screens)] && [[UIScreen screens] count] > 1)
 #define IS_IPAD()               (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
 #define IS_NOT_POWERFUL()       ([modelType() hasPrefix:@"iPhone1"] || [modelType() hasPrefix:@"iPod1,1"] || [modelType() hasPrefix:@"iPod2,1"])
+#define IS_NOT_VERY_POWERFUL()  ([modelType() hasPrefix:@"iPad1"]   || [modelType() hasPrefix:@"iPhone2"] || [modelId hasPrefix:@"iPod3"])
 
 #define DEFAULT_NETGAME_PORT    46631
 
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.m	Sat Dec 11 01:55:16 2010 +0100
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.m	Sat Dec 11 02:30:03 2010 +0100
@@ -386,14 +386,15 @@
     [string release];
     // remove a trailing "" element
     [themeArray removeLastObject];
+
+    // remove images that are too big for certain devices without loading the whole image
     NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL];
     NSMutableArray *mapArray = [[NSMutableArray alloc] init];
     for (NSString *str in mapArrayFull) {
         CGSize imgSize = PSPNGSizeFromMetaData([MAPS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]);
-        // remove images that are too big for certain devices
         if (IS_NOT_POWERFUL() && imgSize.height > 1024.0f)
             continue;
-        if ([modelType() hasPrefix:@"iPad1"] && imgSize.height > 1280.0f)
+        if (IS_NOT_VERY_POWERFUL() && imgSize.height > 1280.0f)
             continue;
         [mapArray addObject:str];
     }
@@ -402,10 +403,9 @@
     NSMutableArray *missionArray = [[NSMutableArray alloc] init];
     for (NSString *str in missionArrayFull) {
         CGSize imgSize = PSPNGSizeFromMetaData([MISSIONS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]);
-        // remove images that are too big for certain devices
         if (IS_NOT_POWERFUL() && imgSize.height > 1024.0f)
             continue;
-        if ([modelType() hasPrefix:@"iPad1"] && imgSize.height > 1280.0f)
+        if (IS_NOT_VERY_POWERFUL() && imgSize.height > 1280.0f)
             continue;
         [missionArray addObject:str];
     }
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Sat Dec 11 01:55:16 2010 +0100
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Sat Dec 11 02:30:03 2010 +0100
@@ -1560,7 +1560,7 @@
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
-		1D6058900D05DD3D006BFB54 /* Hedgewars */ = {
+		1D6058900D05DD3D006BFB54 /* Test Lua */ = {
 			isa = PBXNativeTarget;
 			buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "Hedgewars" */;
 			buildPhases = (
@@ -1651,7 +1651,7 @@
 			);
 			projectRoot = "";
 			targets = (
-				1D6058900D05DD3D006BFB54 /* Hedgewars */,
+				1D6058900D05DD3D006BFB54 /* Test Lua */,
 				928301160F10CAFC00CC5A3C /* fpc */,
 				6179928B114AE0C800BA94A9 /* UpdateDataFolder */,
 			);