equal
deleted
inserted
replaced
141 end; |
141 end; |
142 |
142 |
143 |
143 |
144 procedure RemoveGearFromList(Gear: PGear); |
144 procedure RemoveGearFromList(Gear: PGear); |
145 begin |
145 begin |
146 TryDo((curHandledGear = nil) or (Gear = curHandledGear), 'You''re doing it wrong', true); |
146 if (Gear <> GearsList) and (Gear <> nil) and (Gear^.NextGear = nil) and (Gear^.PrevGear = nil) then |
|
147 begin |
|
148 AddFileLog('Attempted to remove Gear #'+inttostr(Gear^.uid)+' from the list twice.'); |
|
149 exit |
|
150 end; |
|
151 TryDo((Gear = nil) or (curHandledGear = nil) or (Gear = curHandledGear), 'You''re doing it wrong', true); |
147 |
152 |
148 if Gear^.NextGear <> nil then |
153 if Gear^.NextGear <> nil then |
149 Gear^.NextGear^.PrevGear:= Gear^.PrevGear; |
154 Gear^.NextGear^.PrevGear:= Gear^.PrevGear; |
150 if Gear^.PrevGear <> nil then |
155 if Gear^.PrevGear <> nil then |
151 Gear^.PrevGear^.NextGear:= Gear^.NextGear |
156 Gear^.PrevGear^.NextGear:= Gear^.NextGear |
152 else |
157 else |
153 GearsList:= Gear^.NextGear |
158 GearsList:= Gear^.NextGear; |
|
159 |
|
160 Gear^.NextGear:= nil; |
|
161 Gear^.PrevGear:= nil |
154 end; |
162 end; |
155 |
163 |
156 |
164 |
157 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
165 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
158 var gear: PGear; |
166 var gear: PGear; |
629 |
637 |
630 ScriptCall('onGearDelete', gear^.uid); |
638 ScriptCall('onGearDelete', gear^.uid); |
631 |
639 |
632 DeleteCI(Gear); |
640 DeleteCI(Gear); |
633 |
641 |
634 FreeTexture(Gear^.Tex); |
642 FreeAndNilTexture(Gear^.Tex); |
635 Gear^.Tex:= nil; |
|
636 |
643 |
637 // make sure that portals have their link removed before deletion |
644 // make sure that portals have their link removed before deletion |
638 if (Gear^.Kind = gtPortal) then |
645 if (Gear^.Kind = gtPortal) then |
639 begin |
646 begin |
640 if (Gear^.LinkedGear <> nil) then |
647 if (Gear^.LinkedGear <> nil) then |
702 //(Gear^.Hedgehog^.Effects[heResurrectable] = 0) then |
709 //(Gear^.Hedgehog^.Effects[heResurrectable] = 0) then |
703 (Gear^.Hedgehog^.Team^.Clan <> CurrentHedgehog^.Team^.Clan) then |
710 (Gear^.Hedgehog^.Team^.Clan <> CurrentHedgehog^.Team^.Clan) then |
704 with CurrentHedgehog^ do |
711 with CurrentHedgehog^ do |
705 begin |
712 begin |
706 inc(Team^.stats.AIKills); |
713 inc(Team^.stats.AIKills); |
707 FreeTexture(Team^.AIKillsTex); |
714 FreeAndNilTexture(Team^.AIKillsTex); |
708 Team^.AIKillsTex := RenderStringTex(ansistring(inttostr(Team^.stats.AIKills)), Team^.Clan^.Color, fnt16); |
715 Team^.AIKillsTex := RenderStringTex(ansistring(inttostr(Team^.stats.AIKills)), Team^.Clan^.Color, fnt16); |
709 end |
716 end |
710 end; |
717 end; |
711 with Gear^ do |
718 with Gear^ do |
712 begin |
719 begin |
717 CurAmmoGear:= nil; |
724 CurAmmoGear:= nil; |
718 if FollowGear = Gear then |
725 if FollowGear = Gear then |
719 FollowGear:= nil; |
726 FollowGear:= nil; |
720 if lastGearByUID = Gear then |
727 if lastGearByUID = Gear then |
721 lastGearByUID := nil; |
728 lastGearByUID := nil; |
722 RemoveGearFromList(Gear); |
729 if Gear^.Hedgehog^.GearHidden <> Gear then // hidden hedgehogs shouldn't be in the list |
|
730 RemoveGearFromList(Gear); |
|
731 Gear^.Hedgehog^.GearHidden:= nil; |
723 Dispose(Gear) |
732 Dispose(Gear) |
724 end; |
733 end; |
725 |
734 |
726 end. |
735 end. |