hedgewars/uGears.pas
changeset 6380 1ff5ad1d771b
parent 6299 fa5bc796261d
child 6453 11c578d30bd3
equal deleted inserted replaced
6379:ef4288298e57 6380:1ff5ad1d771b
   589 
   589 
   590 ScriptCall('onGearDelete', gear^.uid);
   590 ScriptCall('onGearDelete', gear^.uid);
   591 
   591 
   592 DeleteCI(Gear);
   592 DeleteCI(Gear);
   593 
   593 
   594 if Gear^.Tex <> nil then
   594 FreeTexture(Gear^.Tex);
   595     begin
   595 Gear^.Tex:= nil;
   596     FreeTexture(Gear^.Tex);
       
   597     Gear^.Tex:= nil
       
   598     end;
       
   599 
   596 
   600 // make sure that portals have their link removed before deletion
   597 // make sure that portals have their link removed before deletion
   601 if (Gear^.Kind = gtPortal) then
   598 if (Gear^.Kind = gtPortal) then
   602     begin
   599     begin
   603     if (Gear^.IntersectGear <> nil) then
   600     if (Gear^.IntersectGear <> nil) then
   658         RecountTeamHealth(team);
   655         RecountTeamHealth(team);
   659         if (CurrentHedgehog <> nil) and CurrentHedgehog^.Effects[heResurrectable] and not Gear^.Hedgehog^.Effects[heResurrectable] then
   656         if (CurrentHedgehog <> nil) and CurrentHedgehog^.Effects[heResurrectable] and not Gear^.Hedgehog^.Effects[heResurrectable] then
   660             with CurrentHedgehog^ do 
   657             with CurrentHedgehog^ do 
   661                 begin
   658                 begin
   662                 inc(Team^.stats.AIKills);
   659                 inc(Team^.stats.AIKills);
   663                 if Team^.AIKillsTex <> nil then FreeTexture(Team^.AIKillsTex);
   660                 FreeTexture(Team^.AIKillsTex);
   664                 Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
   661                 Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
   665                 end
   662                 end
   666         end;
   663         end;
   667 with Gear^ do
   664 with Gear^ do
   668     AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind));
   665     AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind));
   801 
   798 
   802     if Gear^.Active then
   799     if Gear^.Active then
   803         begin
   800         begin
   804         if Gear^.RenderTimer and (Gear^.Timer > 500) and ((Gear^.Timer mod 1000) = 0) then
   801         if Gear^.RenderTimer and (Gear^.Timer > 500) and ((Gear^.Timer mod 1000) = 0) then
   805             begin
   802             begin
   806             if Gear^.Tex <> nil then FreeTexture(Gear^.Tex);
   803             FreeTexture(Gear^.Tex);
   807             Gear^.Tex:= RenderStringTex(inttostr(Gear^.Timer div 1000), cWhiteColor, fntSmall);
   804             Gear^.Tex:= RenderStringTex(inttostr(Gear^.Timer div 1000), cWhiteColor, fntSmall);
   808             end;
   805             end;
   809         Gear^.doStep(Gear);
   806         Gear^.doStep(Gear);
   810         // might be useful later
   807         // might be useful later
   811         //ScriptCall('onGearStep', Gear^.uid);
   808         //ScriptCall('onGearStep', Gear^.uid);
  1682     gear^.Hedgehog^.Effects[hePoisoned] := false;
  1679     gear^.Hedgehog^.Effects[hePoisoned] := false;
  1683     if not CurrentHedgehog^.Effects[heResurrectable] then
  1680     if not CurrentHedgehog^.Effects[heResurrectable] then
  1684         with CurrentHedgehog^ do 
  1681         with CurrentHedgehog^ do 
  1685             begin
  1682             begin
  1686             inc(Team^.stats.AIKills);
  1683             inc(Team^.stats.AIKills);
  1687             if Team^.AIKillsTex <> nil then FreeTexture(Team^.AIKillsTex);
  1684             FreeTexture(Team^.AIKillsTex);
  1688             Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
  1685             Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
  1689             end;
  1686             end;
  1690     tempTeam := gear^.Hedgehog^.Team;
  1687     tempTeam := gear^.Hedgehog^.Team;
  1691     DeleteCI(gear);
  1688     DeleteCI(gear);
  1692     FindPlace(gear, false, 0, LAND_WIDTH, true); 
  1689     FindPlace(gear, false, 0, LAND_WIDTH, true);