fix a very rare bug in which CurSlot becomes greater than cMaxCurSlot
authorkoda
Thu, 08 Oct 2009 00:58:17 +0000
changeset 2409 dbf195c3e09c
parent 2408 41ebdb5f1e6e
child 2410 e7bbb27b24b3
fix a very rare bug in which CurSlot becomes greater than cMaxCurSlot other minor changes to cmakefiles and iphone defaults
gameServer/CMakeLists.txt
hedgewars/hwengine.pas
hedgewars/uAmmos.pas
hedgewars/uConsts.pas
hedgewars/uWorld.pas
tools/CreateMacBundle.cmake.in
--- a/gameServer/CMakeLists.txt	Wed Oct 07 17:01:40 2009 +0000
+++ b/gameServer/CMakeLists.txt	Thu Oct 08 00:58:17 2009 +0000
@@ -4,9 +4,6 @@
 	message(FATAL_ERROR "Cannot find GHC")
 endif(NOT ghc_executable)
 
-if(APPLE)
-	find_package(GMP REQUIRED)
-endif(APPLE)
 
 set(hwserver_sources
 	OfficialServer/DBInteraction.hs
--- a/hedgewars/hwengine.pas	Wed Oct 07 17:01:40 2009 +0000
+++ b/hedgewars/hwengine.pas	Thu Oct 08 00:58:17 2009 +0000
@@ -264,9 +264,9 @@
 		isMusicEnabled:= false;
 		isSoundEnabled:= false;
 		cLocaleFName:= 'en.txt';
-		cFullScreen:= false;
+		cFullScreen:= true; //T or F is is the same here
 		cAltDamage:= false;
-		cShowFPS:= false;
+		cShowFPS:= true;
 		val('8', cTimerInterval);
 		cReducedQuality:= false;
 
--- a/hedgewars/uAmmos.pas	Wed Oct 07 17:01:40 2009 +0000
+++ b/hedgewars/uAmmos.pas	Thu Oct 08 00:58:17 2009 +0000
@@ -216,13 +216,16 @@
 
 with Hedgehog do
 	begin
+
 	if (Ammo^[CurSlot, CurAmmo].Count = 0) then
 		begin
 		CurAmmo:= 0;
 		CurSlot:= 0;
-		while (CurSlot <= cMaxSlotIndex) and (Ammo^[CurSlot, CurAmmo].Count = 0) do inc(CurSlot)
+		while (CurSlot < cMaxSlotIndex) and (Ammo^[CurSlot, CurAmmo].Count = 0) do 
+                        inc(CurSlot)
 		end;
-
+                
+        //bad things could happen here in case CurSlot is overflowing
 	ApplyAngleBounds(Hedgehog, Ammo^[CurSlot, CurAmmo].AmmoType);
 
 	with Ammo^[CurSlot, CurAmmo] do
@@ -257,7 +260,7 @@
         begin
         CurAmmo:= 0;
         CurSlot:= 0;
-        while (CurSlot <= cMaxSlotIndex) and
+        while (CurSlot < cMaxSlotIndex) and
               ((Ammo^[CurSlot, CurAmmo].Count = 0) or
               (Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber >= 0))
               do inc(CurSlot)
--- a/hedgewars/uConsts.pas	Wed Oct 07 17:01:40 2009 +0000
+++ b/hedgewars/uConsts.pas	Thu Oct 08 00:58:17 2009 +0000
@@ -154,6 +154,7 @@
 	errmsgIncorrectUse    = 'Incorrect use';
 	errmsgShouldntRun     = 'This program shouldn''t be run manually';
 	errmsgWrongNumber     = 'Wrong parameters number';
+        errmsgSlotsOverflow   = 'CurSlot overflowed';
 
 	msgLoading           = 'Loading ';
 	msgOK                = 'ok';
--- a/hedgewars/uWorld.pas	Wed Oct 07 17:01:40 2009 +0000
+++ b/hedgewars/uWorld.pas	Thu Oct 08 00:58:17 2009 +0000
@@ -32,7 +32,11 @@
 {$ENDIF}
 var FollowGear: PGear = nil;
 	WindBarWidth: LongInt = 0;
-	bShowAmmoMenu: boolean = false;
+{$IFDEF IPHONEOS}
+	bShowAmmoMenu: boolean = true;
+{$ELSE}
+       	bShowAmmoMenu: boolean = false;
+{$ENDIF}
 	bSelected: boolean = false;
 	bShowFinger: boolean = false;
 	Frames: Longword = 0;
@@ -419,16 +423,12 @@
       r.w:= 2 + TeamHealthBarWidth;
       r.h:= HealthTex^.h;
 
-      DrawFromRect(0,
-                        cScreenHeight + DrawHealthY,
-                        @r, HealthTex);
+      DrawFromRect(0, cScreenHeight + DrawHealthY, @r, HealthTex);
 
       inc(r.x, cTeamHealthWidth + 2);
       r.w:= 3;
 
-      DrawFromRect(TeamHealthBarWidth + 2,
-                        cScreenHeight + DrawHealthY,
-                        @r, HealthTex);
+      DrawFromRect(TeamHealthBarWidth + 2, cScreenHeight + DrawHealthY, @r, HealthTex);
       end;
 
 // Lag alert
--- a/tools/CreateMacBundle.cmake.in	Wed Oct 07 17:01:40 2009 +0000
+++ b/tools/CreateMacBundle.cmake.in	Thu Oct 08 00:58:17 2009 +0000
@@ -10,9 +10,6 @@
 execute_process(COMMAND cp -pPR ${VORBIS_LIBRARY}	${CMAKE_BINARY_DIR}/${frameworks_dir}/Vorbis.framework)
 
 if(SPARKLE_FOUND)
-execute_process(COMMAND cp -pPR ${SPARKLE_LIBRARY}	${CMAKE_BINARY_DIR}/${frameworks_dir}/Sparkle.framework)
+	execute_process(COMMAND cp -pPR ${SPARKLE_LIBRARY}	${CMAKE_BINARY_DIR}/${frameworks_dir}/Sparkle.framework)
 endif()
 
-if(${HAVE_NETSERVER})
-execute_process(COMMAND cp -pPR ${GMP_LIBRARY} 		${CMAKE_BINARY_DIR}/${frameworks_dir}/GMP.framework)
-endif()