hedgewars/uVisualGears.pas
changeset 4780 8571151411b3
parent 4772 02370ca8e92c
child 4782 603916ddf4b6
equal deleted inserted replaced
4778:1565a553d200 4780:8571151411b3
   326 
   326 
   327     if Gear^.NextGear <> nil then Gear^.NextGear^.PrevGear:= Gear^.PrevGear;
   327     if Gear^.NextGear <> nil then Gear^.NextGear^.PrevGear:= Gear^.PrevGear;
   328     if Gear^.PrevGear <> nil then Gear^.PrevGear^.NextGear:= Gear^.NextGear
   328     if Gear^.PrevGear <> nil then Gear^.PrevGear^.NextGear:= Gear^.NextGear
   329     else VisualGearsList:= Gear^.NextGear;
   329     else VisualGearsList:= Gear^.NextGear;
   330 
   330 
       
   331     if lastVisualGearByUID = Gear then lastVisualGearByUID:= nil;
       
   332 
   331     Dispose(Gear);
   333     Dispose(Gear);
   332 end;
   334 end;
   333 
   335 
   334 procedure ProcessVisualGears(Steps: Longword);
   336 procedure ProcessVisualGears(Steps: Longword);
   335 var Gear, t: PVisualGear;
   337 var Gear, t: PVisualGear;
   522 
   524 
   523 function  VisualGearByUID(uid : Longword) : PVisualGear;
   525 function  VisualGearByUID(uid : Longword) : PVisualGear;
   524 var vg: PVisualGear;
   526 var vg: PVisualGear;
   525 begin
   527 begin
   526 VisualGearByUID:= nil;
   528 VisualGearByUID:= nil;
       
   529 if uid = 0 then exit;
       
   530 if (lastVisualGearByUID <> nil) and (lastVisualGearByUID^.uid = uid) then
       
   531     begin
       
   532     VisualGearByUID:= lastVisualGearByUID;
       
   533     exit
       
   534     end;
   527 vg:= VisualGearsList;
   535 vg:= VisualGearsList;
   528 while vg <> nil do
   536 while vg <> nil do
   529     begin
   537     begin
   530     if vg^.uid = uid then
   538     if vg^.uid = uid then
   531         begin
   539         begin
   532             VisualGearByUID:= vg;
   540         lastVisualGearByUID:= vg;
   533             exit
   541         VisualGearByUID:= vg;
       
   542         exit
   534         end;
   543         end;
   535     vg:= vg^.NextGear
   544     vg:= vg^.NextGear
   536     end
   545     end
   537 end;
   546 end;
   538 
   547