hedgewars/uGears.pas
changeset 48 0f396d0c429d
parent 47 8daf1ee0b9a3
child 49 3afe33c1cf06
equal deleted inserted replaced
47:8daf1ee0b9a3 48:0f396d0c429d
   226                    GearsList:= Result
   226                    GearsList:= Result
   227                    end
   227                    end
   228 end;
   228 end;
   229 
   229 
   230 procedure DeleteGear(Gear: PGear);
   230 procedure DeleteGear(Gear: PGear);
       
   231 var team: PTeam;
   231 begin
   232 begin
   232 if Gear.CollIndex < High(Longword) then DeleteCR(Gear);
   233 if Gear.CollIndex < High(Longword) then DeleteCR(Gear);
   233 if Gear.Kind = gtHedgehog then
   234 if Gear.Kind = gtHedgehog then
   234    if CurAmmoGear <> nil then
   235    if CurAmmoGear <> nil then
   235       begin
   236       begin
   237       Gear.Message:= gm_Destroy;
   238       Gear.Message:= gm_Destroy;
   238       CurAmmoGear.Message:= gm_Destroy;
   239       CurAmmoGear.Message:= gm_Destroy;
   239       exit
   240       exit
   240       end else
   241       end else
   241       begin
   242       begin
   242       RecountTeamHealth(PHedgehog(Gear.Hedgehog).Team);
   243       team:= PHedgehog(Gear.Hedgehog).Team;
   243       PHedgehog(Gear.Hedgehog).Gear:= nil;
   244       PHedgehog(Gear.Hedgehog).Gear:= nil;
       
   245       RecountTeamHealth(team);
   244       end;
   246       end;
   245 if CurAmmoGear = Gear then
   247 if CurAmmoGear = Gear then
   246    CurAmmoGear:= nil;
   248    CurAmmoGear:= nil;
   247 if FollowGear = Gear then FollowGear:= nil;
   249 if FollowGear = Gear then FollowGear:= nil;
   248 {$IFDEF DEBUGFILE}AddFileLog('DeleteGear: handle = '+inttostr(integer(Gear)));{$ENDIF}
   250 {$IFDEF DEBUGFILE}AddFileLog('DeleteGear: handle = '+inttostr(integer(Gear)));{$ENDIF}