hedgewars/uWorld.pas
changeset 14562 42f7ce0f5bc6
parent 14559 1dab5d92aca7
child 14563 e68b91abbcf5
--- a/hedgewars/uWorld.pas	Thu Jan 10 18:08:02 2019 +0100
+++ b/hedgewars/uWorld.pas	Thu Jan 10 18:30:14 2019 +0100
@@ -42,6 +42,7 @@
 procedure MoveCamera;
 procedure onFocusStateChanged;
 procedure updateCursorVisibility;
+procedure updateTouchWidgets(ammoType: TAmmoType);
 
 implementation
 uses
@@ -781,23 +782,7 @@
                 SetWeapon(Ammo^[Slot, Pos].AmmoType);
                 bSelected:= false;
                 FreeAndNilTexture(WeaponTooltipTex);
-{$IFDEF USE_TOUCH_INTERFACE}//show the aiming buttons + animation
-                if (Ammo^[Slot, Pos].Propz and ammoprop_NeedUpDown) <> 0 then
-                    begin
-                    if (not arrowUp.show) then
-                        begin
-                        animateWidget(@arrowUp, true, true);
-                        animateWidget(@arrowDown, true, true);
-                        end;
-                    end
-                else
-                    if arrowUp.show then
-                        begin
-                        animateWidget(@arrowUp, true, false);
-                        animateWidget(@arrowDown, true, false);
-                        end;
-                SetUtilityWidgetState(Ammo^[Slot, Pos].AmmoType);
-{$ENDIF}
+                updateTouchWidgets(Ammo^[Slot, Pos].AmmoType);
                 exit
                 end;
             end
@@ -2129,6 +2114,30 @@
         SDL_ShowCursor(ord(GameState = gsConfirm))
 end;
 
+procedure updateTouchWidgets(ammoType: TAmmoType);
+begin
+{$IFDEF USE_TOUCH_INTERFACE}
+//show the aiming buttons + animation
+if (Ammoz[ammoType].Ammo.Propz and ammoprop_NeedUpDown) <> 0 then
+    begin
+    if (not arrowUp.show) then
+        begin
+        animateWidget(@arrowUp, true, true);
+        animateWidget(@arrowDown, true, true);
+        end;
+    end
+else
+    if arrowUp.show then
+        begin
+        animateWidget(@arrowUp, true, false);
+        animateWidget(@arrowDown, true, false);
+        end;
+SetUtilityWidgetState(ammoType);
+{$ELSE}
+ammoType:= ammoType; // avoid hint
+{$ENDIF}
+end;
+
 procedure SetUtilityWidgetState(ammoType: TAmmoType);
 begin
 {$IFDEF USE_TOUCH_INTERFACE}