hedgewars/GSHandlers.inc
changeset 3480 c4c3f3512404
parent 3476 1ec68b8d3bd1
child 3483 54ff8cbabaa6
equal deleted inserted replaced
3479:972ae3ec178a 3480:c4c3f3512404
  3199         if iterator = nil then
  3199         if iterator = nil then
  3200             break;
  3200             break;
  3201         // end of list
  3201         // end of list
  3202 
  3202 
  3203         // don't port portals or other gear that wouldn't make sense
  3203         // don't port portals or other gear that wouldn't make sense
  3204         if (iterator^.Kind = gtPortal) or (iterator^.Kind = gtRope) then
  3204         if (iterator^.Kind = gtPortal) or (iterator^.Kind = gtRope) or (iterator^.PortalCounter > 20) then
  3205             continue;
  3205             continue;
  3206 
  3206 
  3207         // don't port hogs on rope
  3207         // don't port hogs on rope
  3208         if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil)
  3208         if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil)
  3209            and (iterator = CurrentHedgehog^.Gear) and (CurAmmoGear <> nil) and (CurAmmoGear^.Kind =
  3209            and (iterator = CurrentHedgehog^.Gear) and (CurAmmoGear <> nil) and (CurAmmoGear^.Kind =
  3244             continue;
  3244             continue;
  3245 
  3245 
  3246         iterator^.Active := true;
  3246         iterator^.Active := true;
  3247         iterator^.State := iterator^.State or gstMoving;
  3247         iterator^.State := iterator^.State or gstMoving;
  3248         DeleteCI(iterator);
  3248         DeleteCI(iterator);
       
  3249 
       
  3250         // Until loops are reliably broken
       
  3251         inc(iterator^.PortalCounter);
  3249 
  3252 
  3250         // TODO: more accurate porting
  3253         // TODO: more accurate porting
  3251         cdxy := Distance(conPortal^.dX, conPortal^.dY);
  3254         cdxy := Distance(conPortal^.dX, conPortal^.dY);
  3252         s := (Int2hwFloat(Gear^.Radius)) / cdxy;
  3255         s := (Int2hwFloat(Gear^.Radius)) / cdxy;
  3253 
  3256 
  3405                             newPortal^.IntersectGear := iterator;
  3408                             newPortal^.IntersectGear := iterator;
  3406                             iterator^.IntersectGear := newPortal;
  3409                             iterator^.IntersectGear := newPortal;
  3407                             iterator^.Health := newPortal^.Health;
  3410                             iterator^.Health := newPortal^.Health;
  3408                         end;
  3411                         end;
  3409                     end;
  3412                     end;
       
  3413                 iterator^.PortalCounter:= 0;
  3410                 iterator := iterator^.NextGear
  3414                 iterator := iterator^.NextGear
  3411             end;
  3415             end;
  3412         end;
  3416         end;
  3413     newPortal^.doStep := @doStepMovingPortal;
  3417     newPortal^.doStep := @doStepMovingPortal;
  3414 end;
  3418 end;