# HG changeset patch
# User koda
# Date 1289068849 -3600
# Node ID 050163c35c83e6ee7fbfb772114c09b569e9177e
# Parent 51200479f9d8d09a7aa1155c6e618a5169726d24
perform an additional check on gamestart
diff -r 51200479f9d8 -r 050163c35c83 hedgewars/PascalExports.pas
--- a/hedgewars/PascalExports.pas Sat Nov 06 18:21:30 2010 +0100
+++ b/hedgewars/PascalExports.pas Sat Nov 06 19:40:49 2010 +0100
@@ -194,7 +194,8 @@
function HW_isAmmoMenuNotAllowed: boolean; cdecl; export;
begin;
- exit ( (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) );
+ exit ( (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or
+ ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) );
end;
function HW_isPaused: boolean; cdecl; export;
diff -r 51200479f9d8 -r 050163c35c83 project_files/HedgewarsMobile/Classes/GameConfigViewController.m
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Sat Nov 06 18:21:30 2010 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Sat Nov 06 19:40:49 2010 +0100
@@ -140,7 +140,7 @@
[alert release];
return NO;
}
-
+
// play only if there is more than one team
if ([self.teamConfigViewController.listOfSelectedTeams count] < 2) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Too few teams playing",@"")
@@ -152,7 +152,7 @@
[alert release];
return NO;
}
-
+
// play if there's room for enough hogs in the selected map
int hogs = 0;
for (NSDictionary *teamData in teamConfigViewController.listOfSelectedTeams)
@@ -168,7 +168,8 @@
[alert release];
return NO;
}
-
+
+ // play if there aren't too many teams
if ([self.teamConfigViewController.listOfSelectedTeams count] > HW_getMaxNumberOfTeams()) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Too many teams",@"")
message:NSLocalizedString(@"Max six teams are allowed in the same game",@"")
@@ -179,7 +180,8 @@
[alert release];
return NO;
}
-
+
+ // play only if one scheme and one weapon are selected
if ([self.schemeWeaponConfigViewController.selectedScheme length] == 0 || [self.schemeWeaponConfigViewController.selectedWeapon length] == 0 ) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Missing detail",@"")
message:NSLocalizedString(@"Select one Scheme and one Weapon for this game",@"")
@@ -191,6 +193,21 @@
return NO;
}
+ // play if the gameflags are set correctly (divideteam works only with 2 teams
+ NSString *schemePath = [[NSString alloc] initWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),self.schemeWeaponConfigViewController.selectedScheme];
+ NSArray *gameFlags = [[NSDictionary dictionaryWithContentsOfFile:schemePath] objectForKey:@"gamemod"];
+ [schemePath release];
+ if ([[gameFlags objectAtIndex:2] boolValue] && [self.teamConfigViewController.listOfSelectedTeams count] != 2) {
+ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Scheme mismatch",@"")
+ message:NSLocalizedString(@"The scheme you selected allows only for two teams",@"")
+ delegate:nil
+ cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"")
+ otherButtonTitles:nil];
+ [alert show];
+ [alert release];
+ return NO;
+ }
+
return YES;
}
diff -r 51200479f9d8 -r 050163c35c83 project_files/HedgewarsMobile/Resources/Settings/iFrontend/gameFlags_en.plist
--- a/project_files/HedgewarsMobile/Resources/Settings/iFrontend/gameFlags_en.plist Sat Nov 06 18:21:30 2010 +0100
+++ b/project_files/HedgewarsMobile/Resources/Settings/iFrontend/gameFlags_en.plist Sat Nov 06 19:40:49 2010 +0100
@@ -20,11 +20,11 @@
description
- Teams will start on opposite sides of the terrain (two teams only)
+ Teams will start on opposite sides of the terrain
image
TeamsDivide
title
- Divide Team
+ Divide Team (max 2 teams)
description
@@ -84,7 +84,7 @@
description
- Defend your fort and destroy the opponents (two teams only)
+ Defend your fort and destroy the opponents
image
Forts
title