# HG changeset patch
# User koda
# Date 1281744627 -7200
# Node ID 97cf933e5bd2c37a62758d9316b0fb38e7dd13ea
# Parent f10626e18b8ab57eb726c4af2f08419c329b42a4
disable AI teleport
show on screen controls only if hedgehog is not a hog
fix reloading of teams
diff -r f10626e18b8a -r 97cf933e5bd2 hedgewars/PascalExports.pas
--- a/hedgewars/PascalExports.pas Fri Aug 13 02:44:44 2010 +0200
+++ b/hedgewars/PascalExports.pas Sat Aug 14 02:10:27 2010 +0200
@@ -202,7 +202,7 @@
function HW_isWeaponRequiringClick: boolean; cdecl; export;
begin
- if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) then
+ if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and (CurrentHedgehog^.BotLevel = 0) then
exit( (CurrentHedgehog^.Gear^.State and gstHHChooseTarget) <> 0 )
else
exit(false);
@@ -213,12 +213,15 @@
begin
CurSlot:= CurrentHedgehog^.CurSlot;
CurAmmo:= CurrentHedgehog^.CurAmmo;
- exit( (CurrentHedgehog^.Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Timerable) <> 0)
+ if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Ammo <> nil) and (CurrentHedgehog^.BotLevel = 0) then
+ exit( (CurrentHedgehog^.Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Timerable) <> 0)
+ else
+ exit(false);
end;
function HW_isWeaponSwitch: boolean cdecl; export;
begin
- if CurAmmoGear <> nil then
+ if (CurAmmoGear <> nil) and (CurrentHedgehog^.BotLevel = 0) then
exit(CurAmmoGear^.AmmoType = amSwitch)
else
exit(false)
@@ -229,7 +232,10 @@
begin
CurSlot:= CurrentHedgehog^.CurSlot;
CurAmmo:= CurrentHedgehog^.CurAmmo;
- exit (CurrentHedgehog^.Ammo^[CurSlot, CurAmmo].AmmoType = amRope)
+ if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Ammo <> nil) and (CurrentHedgehog^.BotLevel = 0) then
+ exit (CurrentHedgehog^.Ammo^[CurSlot, CurAmmo].AmmoType = amRope)
+ else
+ exit(false);
end;
procedure HW_setGrenadeTime(time: LongInt); cdecl; export;
@@ -243,7 +249,8 @@
CurSlot:= CurrentHedgehog^.CurSlot;
CurAmmo:= CurrentHedgehog^.CurAmmo;
// this most likely won't work in network game
- if (CurrentHedgehog^.Ammo^[CurSlot, CurAmmo].AmmoType = amPiano) then
+ if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Ammo <> nil) and (CurrentHedgehog^.BotLevel = 0)
+ and (CurrentHedgehog^.Ammo^[CurSlot, CurAmmo].AmmoType = amPiano) then
case snd of
0: PlaySound(sndPiano0);
1: PlaySound(sndPiano1);
@@ -256,8 +263,6 @@
else PlaySound(sndPiano8);
end;
end;
-
-//amSwitch
{$ENDIF}
end.
diff -r f10626e18b8a -r 97cf933e5bd2 hedgewars/hwengine.pas
--- a/hedgewars/hwengine.pas Fri Aug 13 02:44:44 2010 +0200
+++ b/hedgewars/hwengine.pas Sat Aug 14 02:10:27 2010 +0200
@@ -216,7 +216,7 @@
{$IFDEF DEBUGFILE}
cShowFPS:= true;
{$ELSE}
- cShowFPS:= true; // update me at release time
+ cShowFPS:= false; // update me at release time
{$ENDIF}
cInitVolume:= 100;
diff -r f10626e18b8a -r 97cf933e5bd2 hedgewars/uAIAmmoTests.pas
--- a/hedgewars/uAIAmmoTests.pas Fri Aug 13 02:44:44 2010 +0200
+++ b/hedgewars/uAIAmmoTests.pas Sat Aug 14 02:10:27 2010 +0200
@@ -71,7 +71,8 @@
(proc: nil; flags: 0), // amMineStrike
(proc: nil; flags: 0), // amBlowTorch
(proc: nil; flags: 0), // amGirder
- (proc: @TestTeleport; flags: amtest_OnTurn), // amTeleport
+ (proc: nil; flags: 0), // amTeleport
+ //(proc: @TestTeleport; flags: amtest_OnTurn), // amTeleport
(proc: nil; flags: 0), // amSwitch
(proc: @TestMortar; flags: 0), // amMortar
(proc: nil; flags: 0), // amKamikaze
diff -r f10626e18b8a -r 97cf933e5bd2 project_files/HedgewarsMobile/Classes/GameConfigViewController.m
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Fri Aug 13 02:44:44 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Sat Aug 14 02:10:27 2010 +0200
@@ -33,10 +33,8 @@
otherButtonTitles:nil];
[alert show];
[alert release];
- } else {
+ } else
[[self parentViewController] dismissModalViewControllerAnimated:YES];
-
- }
break;
case 1:
theButton.enabled = NO;
@@ -230,6 +228,20 @@
[super viewDidAppear:animated];
}
+-(void) viewWillDisappear:(BOOL)animated {
+ [mapConfigViewController viewWillDisappear:animated];
+ [teamConfigViewController viewWillDisappear:animated];
+ [schemeWeaponConfigViewController viewWillDisappear:animated];
+ [super viewWillDisappear:animated];
+}
+
+-(void) viewDidDisappear:(BOOL)animated {
+ [mapConfigViewController viewDidDisappear:animated];
+ [teamConfigViewController viewDidDisappear:animated];
+ [schemeWeaponConfigViewController viewDidDisappear:animated];
+ [super viewDidDisappear:animated];
+}
+
-(void) didReceiveMemoryWarning {
if (activeController.view.superview == nil)
activeController = nil;
diff -r f10626e18b8a -r 97cf933e5bd2 project_files/HedgewarsMobile/Classes/OverlayViewController.m
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m Fri Aug 13 02:44:44 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m Sat Aug 14 02:10:27 2010 +0200
@@ -133,8 +133,6 @@
SDL_VideoDevice *_this = SDL_GetVideoDevice();
SDL_VideoDisplay *display = &_this->displays[0];
sdlwindow = display->windows;
-
- doDim();
}
-(void) viewDidUnload {
diff -r f10626e18b8a -r 97cf933e5bd2 project_files/HedgewarsMobile/Classes/TeamConfigViewController.h
--- a/project_files/HedgewarsMobile/Classes/TeamConfigViewController.h Fri Aug 13 02:44:44 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/TeamConfigViewController.h Sat Aug 14 02:10:27 2010 +0200
@@ -12,10 +12,11 @@
@interface TeamConfigViewController : UITableViewController {
NSMutableArray *listOfTeams;
NSMutableArray *listOfSelectedTeams;
- BOOL isFirstLoad;
+ NSArray *cachedContentsOfDir;
}
@property (nonatomic, retain) NSMutableArray *listOfTeams;
@property (nonatomic, retain) NSMutableArray *listOfSelectedTeams;
+@property (nonatomic, retain) NSArray *cachedContentsOfDir;
@end
diff -r f10626e18b8a -r 97cf933e5bd2 project_files/HedgewarsMobile/Classes/TeamConfigViewController.m
--- a/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m Fri Aug 13 02:44:44 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m Sat Aug 14 02:10:27 2010 +0200
@@ -12,7 +12,7 @@
#import "SquareButtonView.h"
@implementation TeamConfigViewController
-@synthesize listOfTeams, listOfSelectedTeams;
+@synthesize listOfTeams, listOfSelectedTeams, cachedContentsOfDir;
#define NUMBERBUTTON_TAG 123456
#define SQUAREBUTTON_TAG 654321
@@ -25,7 +25,6 @@
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44);
- isFirstLoad = YES;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[self.tableView setBackgroundView:nil];
@@ -38,11 +37,11 @@
-(void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
+ NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TEAMS_DIRECTORY() error:NULL];
// avoid overwriting selected teams when returning on this view
- if (isFirstLoad) {
+ if ([cachedContentsOfDir isEqualToArray:contentsOfDir] == NO) {
// integer representation of various color (defined in SquareButtonView)
NSUInteger colors[6] = { 4421353, 4100897, 10632635, 16749353, 14483456, 7566195 };
- NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TEAMS_DIRECTORY() error:NULL];
NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[contentsOfDir count]];
for (int i = 0; i < [contentsOfDir count]; i++) {
NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
@@ -58,7 +57,8 @@
NSMutableArray *emptyArray = [[NSMutableArray alloc] initWithObjects:nil];
self.listOfSelectedTeams = emptyArray;
[emptyArray release];
- isFirstLoad = NO;
+
+ cachedContentsOfDir = [[NSArray alloc] initWithArray:contentsOfDir copyItems:YES];
}
[self.tableView reloadData];
}
@@ -191,17 +191,22 @@
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Relinquish ownership any cached data, images, etc that aren't in use.
+ self.cachedContentsOfDir = nil;
}
-(void) viewDidUnload {
self.listOfTeams = nil;
+ self.listOfSelectedTeams = nil;
+ self.cachedContentsOfDir = nil;
MSG_DIDUNLOAD();
[super viewDidUnload];
}
-(void) dealloc {
- [self.listOfTeams release];
+ [listOfTeams release];
+ [listOfSelectedTeams release];
+ [cachedContentsOfDir release];
[super dealloc];
}
diff -r f10626e18b8a -r 97cf933e5bd2 project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Fri Aug 13 02:44:44 2010 +0200
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sat Aug 14 02:10:27 2010 +0200
@@ -2020,7 +2020,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\nmkdir ${PROJECT_DIR}/Data/Graphics/Btn\ncp ${PROJECT_DIR}/../../QTfrontend/res/btn*.png ${PROJECT_DIR}/Data/Graphics/Btn\ncp ${PROJECT_DIR}/../../QTfrontend/res/ammopic.png ${PROJECT_DIR}/Data/Graphics/Btn/iconAmmo.png\ncp ${PROJECT_DIR}/../../QTfrontend/res/icon*.png ${PROJECT_DIR}/Data/Graphics/Btn\ncp -R ${PROJECT_DIR}/../../QTfrontend/res/botlevels ${PROJECT_DIR}/Data/Graphics/Hedgehog/botlevels\n\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\n\n#delete desktop frontend translation\nrm -rf ${PROJECT_DIR}/Data/Locale/hedgewars_*\n\n#delete dummy maps\nrm -rf ${PROJECT_DIR}/Data/Maps/{test*,KnockBall,Ruler,BasketBall}\n\n#the following ones must be removed when their support is implemented\n\n#delete some voices\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/{Classic,British,Mobster,Pirate,Robot,Russian,Singer,Surfer}\n\n#delete all names\nrm -rf ${PROJECT_DIR}/Data/Names/\n\n#delete all missions\nrm -rf ${PROJECT_DIR}/Data/Missions/\n\n#delete all reserved hats\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/";
+ shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\nmkdir ${PROJECT_DIR}/Data/Graphics/Btn\ncp ${PROJECT_DIR}/../../QTfrontend/res/btn*.png ${PROJECT_DIR}/Data/Graphics/Btn\ncp ${PROJECT_DIR}/../../QTfrontend/res/ammopic.png ${PROJECT_DIR}/Data/Graphics/Btn/iconAmmo.png\ncp ${PROJECT_DIR}/../../QTfrontend/res/icon*.png ${PROJECT_DIR}/Data/Graphics/Btn\ncp -R ${PROJECT_DIR}/../../QTfrontend/res/botlevels ${PROJECT_DIR}/Data/Graphics/Hedgehog/botlevels\n\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\n\n#delete desktop frontend translation\nrm -rf ${PROJECT_DIR}/Data/Locale/hedgewars_*\n\n#delete dummy maps\nrm -rf ${PROJECT_DIR}/Data/Maps/{test*,KnockBall,Ruler,BasketBall}\n\n#delete forbidden maps\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese}\nrm -rf ${PROJECT_DIR}/Data/Themes/City/Flake.png\n\n#the following ones must be removed when their support is implemented\n\n#delete some voices\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/{Classic,British,Mobster,Robot,Russian,Singer,Surfer}\n\n#delete all names\nrm -rf ${PROJECT_DIR}/Data/Names/\n\n#delete all missions\nrm -rf ${PROJECT_DIR}/Data/Missions/\n\n#delete all reserved hats\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/";
showEnvVarsInLog = 0;
};
9283011B0F10CB2D00CC5A3C /* Build libfpc.a */ = {
diff -r f10626e18b8a -r 97cf933e5bd2 project_files/HedgewarsMobile/Resources/MainMenuViewController-iPad.xib
--- a/project_files/HedgewarsMobile/Resources/MainMenuViewController-iPad.xib Fri Aug 13 02:44:44 2010 +0200
+++ b/project_files/HedgewarsMobile/Resources/MainMenuViewController-iPad.xib Sat Aug 14 02:10:27 2010 +0200
@@ -57,7 +57,7 @@
- 188
+ 215
0.0
0.0
0.0
@@ -93,7 +93,7 @@