hedgewars/uGears.pas
changeset 3422 41ae3c48faa0
parent 3415 1ca22b3493e9
child 3427 b49ed5673727
equal deleted inserted replaced
3421:7c72f4d556d1 3422:41ae3c48faa0
    58             IntersectGear: PGear;
    58             IntersectGear: PGear;
    59             FlightTime: Longword;
    59             FlightTime: Longword;
    60             uid: Longword;
    60             uid: Longword;
    61             ImpactSound: TSound; // first sound, others have to be after it in the sounds def.
    61             ImpactSound: TSound; // first sound, others have to be after it in the sounds def.
    62             nImpactSounds: Word; // count of ImpactSounds
    62             nImpactSounds: Word; // count of ImpactSounds
    63             SoundChannel: LongInt;
    63             SoundChannel: LongInt
    64             PortedCounter: LongWord // TEMPORARY. To break portal loops pending handling it w/ something a bit saner.
       
    65         end;
    64         end;
    66 
    65 
    67 var AllInactive: boolean;
    66 var AllInactive: boolean;
    68     PrvInactive: boolean;
    67     PrvInactive: boolean;
    69     CurAmmoGear: PGear;
    68     CurAmmoGear: PGear;
   509     begin
   508     begin
   510     FreeTexture(Gear^.Tex);
   509     FreeTexture(Gear^.Tex);
   511     Gear^.Tex:= nil
   510     Gear^.Tex:= nil
   512     end;
   511     end;
   513 
   512 
   514 if Gear^.Kind = gtHedgehog then
   513 // make sure that portals have their link removed before deletion
       
   514 if (Gear^.Kind = gtPortal) and (Gear^.IntersectGear <> nil) then
       
   515     Gear^.IntersectGear^.IntersectGear:= nil
       
   516 
       
   517 else if Gear^.Kind = gtHedgehog then
   515     if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then
   518     if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then
   516         begin
   519         begin
   517         Gear^.Message:= gm_Destroy;
   520         Gear^.Message:= gm_Destroy;
   518         CurAmmoGear^.Message:= gm_Destroy;
   521         CurAmmoGear^.Message:= gm_Destroy;
   519         exit
   522         exit
   857                   end;
   860                   end;
   858     iterator:= GearsList;
   861     iterator:= GearsList;
   859     tmpGear:= nil;
   862     tmpGear:= nil;
   860     while iterator <> nil do
   863     while iterator <> nil do
   861         begin
   864         begin
   862         iterator^.PortedCounter:= 0;
       
   863         if (iterator^.Kind = gtPortal) then 
   865         if (iterator^.Kind = gtPortal) then 
   864             begin
   866             begin
   865             tmpGear:= iterator;
   867             tmpGear:= iterator;
   866             if iterator^.NextGear <> nil then iterator:= iterator^.NextGear;
   868             if iterator^.NextGear <> nil then iterator:= iterator^.NextGear;
   867             DeleteGear(tmpGear)
   869             DeleteGear(tmpGear)