diff -r 9b7c8c5a94e0 -r 3851ce4f2061 hedgewars/uGearsList.pas --- a/hedgewars/uGearsList.pas Sat Aug 15 16:23:00 2015 +0300 +++ b/hedgewars/uGearsList.pas Thu Sep 03 20:59:48 2015 +0300 @@ -1,6 +1,6 @@ (* * Hedgewars, a free turn based strategy game - * Copyright (c) 2004-2014 Andrey Korotaev + * Copyright (c) 2004-2015 Andrey Korotaev * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -155,7 +155,7 @@ Gear^.NextGear^.PrevGear:= Gear^.PrevGear; if Gear^.PrevGear <> nil then Gear^.PrevGear^.NextGear:= Gear^.NextGear -else +else GearsList:= Gear^.NextGear; Gear^.NextGear:= nil; @@ -238,6 +238,8 @@ gtMelonPiece: begin gear^.AdvBounce:= 1; gear^.Density:= _2; + gear^.Elasticity:= _0_8; + gear^.Friction:= _0_995; gear^.Radius:= 4 end; gtHedgehog: begin @@ -669,6 +671,7 @@ t,i: Longword; k: boolean; cakeData: PCakeData; + iterator: PGear; begin ScriptCall('onGearDelete', gear^.uid); @@ -677,6 +680,31 @@ FreeAndNilTexture(Gear^.Tex); +// remove potential links to this gear +// currently relevant to: gears linked by hammer +if (Gear^.Kind = gtHedgehog) or (Gear^.Kind = gtMine) or (Gear^.Kind = gtExplosives) then + begin + // check all gears for stuff to port through + iterator := nil; + while true do + begin + + // iterate through GearsList + if iterator = nil then + iterator := GearsList + else + iterator := iterator^.NextGear; + + // end of list? + if iterator = nil then + break; + + if iterator^.LinkedGear = Gear then + iterator^.LinkedGear:= nil; + end; + + end; + // make sure that portals have their link removed before deletion if (Gear^.Kind = gtPortal) then begin @@ -733,10 +761,12 @@ k:= true; if not k then for i:= 0 to Pred(team^.Clan^.TeamsNumber) do - begin - team^.Clan^.Teams[i]^.hasGone:= true; - TeamGoneEffect(team^.Clan^.Teams[i]^) - end + with team^.Clan^.Teams[i]^ do + for t:= 0 to cMaxHHIndex do + if Hedgehogs[t].Gear <> nil then + Hedgehogs[t].Gear^.Health:= 0 + else if (Hedgehogs[t].GearHidden <> nil) then + Hedgehogs[t].GearHidden^.Health:= 0 // hog is still hidden. if tardis should return though, lua, eh... end; // should be not CurrentHedgehog, but hedgehog of the last gear which caused damage to this hog