hedgewars/uGears.pas
changeset 47 8daf1ee0b9a3
parent 46 c99140d2355a
child 48 0f396d0c429d
equal deleted inserted replaced
46:c99140d2355a 47:8daf1ee0b9a3
     1 (*
     1 (*
     2  * Hedgewars, a worms-like game
     2  * Hedgewars, a worms-like game
     3  * Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com>
     3  * Copyright (c) 2004, 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
     4  *
     4  *
     5  * Distributed under the terms of the BSD-modified licence:
     5  * Distributed under the terms of the BSD-modified licence:
     6  *
     6  *
     7  * Permission is hereby granted, free of charge, to any person obtaining a copy
     7  * Permission is hereby granted, free of charge, to any person obtaining a copy
     8  * of this software and associated documentation files (the "Software"), to deal
     8  * of this software and associated documentation files (the "Software"), to deal
   235       begin
   235       begin
   236       {$IFDEF DEBUGFILE}AddFileLog('DeleteGear: Sending gm_Destroy, hh handle = '+inttostr(integer(Gear)));{$ENDIF}
   236       {$IFDEF DEBUGFILE}AddFileLog('DeleteGear: Sending gm_Destroy, hh handle = '+inttostr(integer(Gear)));{$ENDIF}
   237       Gear.Message:= gm_Destroy;
   237       Gear.Message:= gm_Destroy;
   238       CurAmmoGear.Message:= gm_Destroy;
   238       CurAmmoGear.Message:= gm_Destroy;
   239       exit
   239       exit
   240       end else PHedgehog(Gear.Hedgehog).Gear:= nil;
   240       end else
       
   241       begin
       
   242       RecountTeamHealth(PHedgehog(Gear.Hedgehog).Team);
       
   243       PHedgehog(Gear.Hedgehog).Gear:= nil;
       
   244       end;
   241 if CurAmmoGear = Gear then
   245 if CurAmmoGear = Gear then
   242    CurAmmoGear:= nil;
   246    CurAmmoGear:= nil;
   243 if FollowGear = Gear then FollowGear:= nil;
   247 if FollowGear = Gear then FollowGear:= nil;
   244 {$IFDEF DEBUGFILE}AddFileLog('DeleteGear: handle = '+inttostr(integer(Gear)));{$ENDIF}
   248 {$IFDEF DEBUGFILE}AddFileLog('DeleteGear: handle = '+inttostr(integer(Gear)));{$ENDIF}
   245 if Gear.NextGear <> nil then Gear.NextGear.PrevGear:= Gear.PrevGear;
   249 if Gear.NextGear <> nil then Gear.NextGear.PrevGear:= Gear.PrevGear;
   264             Result:= false;
   268             Result:= false;
   265             if Gear.Health < Gear.Damage then Gear.Health:= 0
   269             if Gear.Health < Gear.Damage then Gear.Health:= 0
   266                                          else dec(Gear.Health, Gear.Damage);
   270                                          else dec(Gear.Health, Gear.Damage);
   267             AddGear(Round(Gear.X), Round(Gear.Y) - 32, gtHealthTag, Gear.Damage).Hedgehog:= Gear.Hedgehog;
   271             AddGear(Round(Gear.X), Round(Gear.Y) - 32, gtHealthTag, Gear.Damage).Hedgehog:= Gear.Hedgehog;
   268             RenderHealth(PHedgehog(Gear.Hedgehog)^);
   272             RenderHealth(PHedgehog(Gear.Hedgehog)^);
       
   273             RecountTeamHealth(PHedgehog(Gear.Hedgehog)^.Team);
   269             
   274             
   270             Gear.Damage:= 0
   275             Gear.Damage:= 0
   271             end;
   276             end;
   272       Gear:= Gear.NextGear
   277       Gear:= Gear.NextGear
   273       end;
   278       end;