implement switch for the touch interface
authorXeli
Sun, 29 Apr 2012 21:05:09 +0200
changeset 6962 ec308eabe09b
parent 6961 d5ac09894a1b
child 6963 0c181b88daff
implement switch for the touch interface
hedgewars/uTouch.pas
hedgewars/uWorld.pas
--- a/hedgewars/uTouch.pas	Sun Apr 29 18:08:46 2012 +0200
+++ b/hedgewars/uTouch.pas	Sun Apr 29 21:05:09 2012 +0200
@@ -265,12 +265,15 @@
         ParseTeamCommand('-attack');
     
     if widget = @utilityWidget then
-        if (CurrentHedgehog <> nil) and 
-           (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0)then
-            begin
-            ParseTeamCommand('put');
-            targetted:= true;
-            end;
+        if (CurrentHedgehog <> nil)then
+            if(Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0)then
+                begin
+                ParseTeamCommand('put');
+                targetted:= true;
+                end
+            else if CurAmmoGear^.AmmoType = amSwitch then
+                ParseTeamCommand('switch')
+            else WriteLnToConsole(inttostr(ord(Ammoz[CurrentHedgehog^.CurAmmoType].NameId)) + ' ' + inttostr(ord(sidSwitch)));
     end;
         
 if targetting then
--- a/hedgewars/uWorld.pas	Sun Apr 29 18:08:46 2012 +0200
+++ b/hedgewars/uWorld.pas	Sun Apr 29 21:05:09 2012 +0200
@@ -1765,6 +1765,11 @@
         utilityWidget.sprite:= sprTargetButton;
         animateWidget(@utilityWidget, true, true);
         end
+    else if ammoType = amSwitch then
+        begin
+        utilityWidget.sprite:= sprTargetButton;
+        animateWidget(@utilityWidget, true, true);
+        end
     else if utilityWidget.show then
         animateWidget(@utilityWidget, true, false); 
 end;