--- a/hedgewars/GSHandlers.inc Wed Jul 04 12:41:47 2012 -0400
+++ b/hedgewars/GSHandlers.inc Thu Jul 05 20:53:55 2012 +0400
@@ -2750,16 +2750,17 @@
procedure doStepSwitcherWork(Gear: PGear);
var
HHGear: PGear;
+ hedgehog: PHedgehog;
State: Longword;
begin
AllInactive := false;
if ((Gear^.Message and (not gmSwitch)) <> 0) or (TurnTimeLeft = 0) then
begin
- HHGear := Gear^.Hedgehog^.Gear;
+ hedgehog := Gear^.Hedgehog;
//Msg := Gear^.Message and (not gmSwitch);
DeleteGear(Gear);
- ApplyAmmoChanges(HHGear^.Hedgehog^);
+ ApplyAmmoChanges(hedgehog^);
HHGear := CurrentHedgehog^.Gear;
ApplyAmmoChanges(HHGear^.Hedgehog^);
--- a/hedgewars/uAmmos.pas Wed Jul 04 12:41:47 2012 -0400
+++ b/hedgewars/uAmmos.pas Thu Jul 05 20:53:55 2012 +0400
@@ -303,22 +303,23 @@
procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType);
begin
-with Hedgehog do
- begin
- CurMinAngle:= Ammoz[AmmoType].minAngle;
- if Ammoz[AmmoType].maxAngle <> 0 then
- CurMaxAngle:= Ammoz[AmmoType].maxAngle
- else
- CurMaxAngle:= cMaxAngle;
+if Hedgehog.Gear <> nil then
+ with Hedgehog do
+ begin
+ CurMinAngle:= Ammoz[AmmoType].minAngle;
+ if Ammoz[AmmoType].maxAngle <> 0 then
+ CurMaxAngle:= Ammoz[AmmoType].maxAngle
+ else
+ CurMaxAngle:= cMaxAngle;
- with Hedgehog.Gear^ do
- begin
- if Angle < CurMinAngle then
- Angle:= CurMinAngle;
- if Angle > CurMaxAngle then
- Angle:= CurMaxAngle;
+ with Hedgehog.Gear^ do
+ begin
+ if Angle < CurMinAngle then
+ Angle:= CurMinAngle;
+ if Angle > CurMaxAngle then
+ Angle:= CurMaxAngle;
+ end
end
- end
end;
procedure SwitchToFirstLegalAmmo(var Hedgehog: THedgehog);
@@ -380,12 +381,12 @@
AddCaption(s, Team^.Clan^.Color, capgrpAmmoinfo);
if (Propz and ammoprop_NeedTarget) <> 0 then
begin
- Gear^.State:= Gear^.State or gstHHChooseTarget;
+ if Gear <> nil then Gear^.State:= Gear^.State or gstHHChooseTarget;
isCursorVisible:= true
end
else
begin
- Gear^.State:= Gear^.State and not gstHHChooseTarget;
+ if Gear <> nil then Gear^.State:= Gear^.State and not gstHHChooseTarget;
isCursorVisible:= false
end;
end