Smaxx: less hacks
authorunc0rr
Mon, 12 Oct 2009 19:39:47 +0000
changeset 2434 5faa05d99241
parent 2433 332287d62c81
child 2435 7afc9edac4cf
Smaxx: less hacks
hedgewars/HHHandlers.inc
hedgewars/uAmmos.pas
hedgewars/uWorld.pas
--- a/hedgewars/HHHandlers.inc	Mon Oct 12 19:33:21 2009 +0000
+++ b/hedgewars/HHHandlers.inc	Mon Oct 12 19:39:47 2009 +0000
@@ -43,14 +43,14 @@
 			inc(i);
 			TryDo(i < 2, 'Engine bug: no ammo in current slot', true)
 			end;
-		until (Ammo^[slot, CurAmmo].Count > 0) and ((Team^.Clan^.TurnNumber > Ammoz[Ammo^[slot, CurAmmo].AmmoType].SkipTurns) or ((TrainingFlags and tfIgnoreDelays) <> 0))
+		until (Ammo^[slot, CurAmmo].Count > 0) and (Team^.Clan^.TurnNumber > Ammoz[Ammo^[slot, CurAmmo].AmmoType].SkipTurns)
 		end else
 		begin
 		i:= 0;
 		// check whether there is ammo in slot
 		while (i <= cMaxSlotAmmoIndex)
 		  and ((Ammo^[slot, i].Count = 0)
-		       or ((Team^.Clan^.TurnNumber <= Ammoz[Ammo^[slot, i].AmmoType].SkipTurns) and ((TrainingFlags and tfIgnoreDelays) = 0))) do inc(i);
+		       or (Team^.Clan^.TurnNumber <= Ammoz[Ammo^[slot, i].AmmoType].SkipTurns)) do inc(i);
 
 		if i <= cMaxSlotAmmoIndex then
 			begin
@@ -67,7 +67,7 @@
 begin
 weap:= TAmmoType(Gear^.MsgParam);
 
-if (PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.TurnNumber <= Ammoz[weap].SkipTurns) and ((TrainingFlags and tfIgnoreDelays) = 0) then exit; // weapon is not activated yet
+if PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.TurnNumber <= Ammoz[weap].SkipTurns then exit; // weapon is not activated yet
 
 Gear^.MsgParam:= Ammoz[weap].Slot;
 
--- a/hedgewars/uAmmos.pas	Mon Oct 12 19:33:21 2009 +0000
+++ b/hedgewars/uAmmos.pas	Mon Oct 12 19:39:47 2009 +0000
@@ -75,6 +75,7 @@
     if a <> amNothing then
         begin
         Ammoz[a].Probability:= probability[byte(s[ord(a) + ord(High(TAmmoType))]) - byte('0')];
+		if (TrainingFlags and tfIgnoreDelays) <> 0 then Ammoz[a].SkipTurns:= 0;
         cnt:= byte(s[ord(a)]) - byte('0');
         // avoid things we already have infinite number
         if cnt = 9 then
--- a/hedgewars/uWorld.pas	Mon Oct 12 19:33:21 2009 +0000
+++ b/hedgewars/uWorld.pas	Mon Oct 12 19:39:47 2009 +0000
@@ -138,8 +138,6 @@
 					begin
 					l:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
 
-					if (TrainingFlags and tfIgnoreDelays) <> 0 then l:= -1;
-
 					if l >= 0 then
 						begin
 						DrawSprite(sprAMAmmosBW, x + g * 33 + 35, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
@@ -170,7 +168,7 @@
 		if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
 			DrawTexture(cScreenWidth div 2 + AMxShift - 35, cScreenHeight - 68, CountTexz[Ammo^[Slot, Pos].Count]);
 
-		if bSelected and (((TrainingFlags and tfIgnoreDelays) <> 0) or (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0)) then
+		if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then
 			begin
 			bShowAmmoMenu:= false;
 			SetWeapon(Ammo^[Slot, Pos].AmmoType);