--- a/hedgewars/uVisualGearsHandlers.pas Tue Mar 17 23:57:26 2015 +0300
+++ b/hedgewars/uVisualGearsHandlers.pas Wed Mar 18 22:57:29 2015 +0300
@@ -873,31 +873,47 @@
end;
////////////////////////////////////////////////////////////////////////////////
+var
+ currwindbar: PVisualGear = nil;
+
+procedure doStepSmoothWindBarWork(Gear: PVisualGear; Steps: Longword);
+begin
+ if currwindbar = Gear then
+ begin
+ inc(Gear^.Timer, Steps);
+
+ while Gear^.Timer >= 10 do
+ begin
+ dec(Gear^.Timer, 10);
+ if WindBarWidth < Gear^.Tag then
+ inc(WindBarWidth)
+ else if WindBarWidth > Gear^.Tag then
+ dec(WindBarWidth);
+ end;
+ if cWindspeedf > Gear^.dAngle then
+ begin
+ cWindspeedf := cWindspeedf - Gear^.Angle*Steps;
+ if cWindspeedf < Gear^.dAngle then cWindspeedf:= Gear^.dAngle;
+ end
+ else if cWindspeedf < Gear^.dAngle then
+ begin
+ cWindspeedf := cWindspeedf + Gear^.Angle*Steps;
+ if cWindspeedf > Gear^.dAngle then cWindspeedf:= Gear^.dAngle;
+ end;
+ end;
+
+ if ((WindBarWidth = Gear^.Tag) and (cWindspeedf = Gear^.dAngle)) or (currwindbar <> Gear) then
+ begin
+ if currwindbar = Gear then currwindbar:= nil;
+ DeleteVisualGear(Gear)
+ end
+end;
+
procedure doStepSmoothWindBar(Gear: PVisualGear; Steps: Longword);
begin
-inc(Gear^.Timer, Steps);
-
-while Gear^.Timer >= 10 do
- begin
- dec(Gear^.Timer, 10);
- if WindBarWidth < Gear^.Tag then
- inc(WindBarWidth)
- else if WindBarWidth > Gear^.Tag then
- dec(WindBarWidth);
- end;
-if cWindspeedf > Gear^.dAngle then
- begin
- cWindspeedf := cWindspeedf - Gear^.Angle*Steps;
- if cWindspeedf < Gear^.dAngle then cWindspeedf:= Gear^.dAngle;
- end
-else if cWindspeedf < Gear^.dAngle then
- begin
- cWindspeedf := cWindspeedf + Gear^.Angle*Steps;
- if cWindspeedf > Gear^.dAngle then cWindspeedf:= Gear^.dAngle;
- end;
-
-if (WindBarWidth = Gear^.Tag) and (cWindspeedf = Gear^.dAngle) then
- DeleteVisualGear(Gear)
+ currwindbar:= Gear;
+ Gear^.doStep:= @doStepSmoothWindBarWork;
+ doStepSmoothWindBarWork(Gear, Steps)
end;
////////////////////////////////////////////////////////////////////////////////
procedure doStepStraightShot(Gear: PVisualGear; Steps: Longword);