Fix issue 435, and also unreported bug when 2 or even 4 entries could have selection at the same time in weapons menu.
authorunc0rr
Sat, 27 Oct 2012 21:39:09 +0400
changeset 7840 7d86dbcd6325
parent 7839 e45a7a159981
child 7841 43e68ac28d79
Fix issue #435, and also unreported bug when 2 or even 4 entries could have selection at the same time in weapons menu.
hedgewars/uWorld.pas
--- a/hedgewars/uWorld.pas	Sat Oct 27 19:27:20 2012 +0200
+++ b/hedgewars/uWorld.pas	Sat Oct 27 21:39:09 2012 +0400
@@ -681,8 +681,8 @@
                 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then
                     begin
                     if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( c    * (AMSlotSize+1))) and
-                       (CursorPoint.Y >= (cScreenHeight - AmmoRect.y) - ((c+1) * (AMSlotSize+1))) and
-                       (CursorPoint.X >= AmmoRect.x                   + ( g    * (AMSlotSize+1))) and 
+                       (CursorPoint.Y >  (cScreenHeight - AmmoRect.y) - ((c+1) * (AMSlotSize+1))) and
+                       (CursorPoint.X >  AmmoRect.x                   + ( g    * (AMSlotSize+1))) and 
                        (CursorPoint.X <= AmmoRect.x                   + ((g+1) * (AMSlotSize+1))) then
                         begin
                         Slot:= i;
@@ -1672,8 +1672,8 @@
 
 if (AMState = AMShowingUp) or (AMState = AMShowing) then
 begin
-    if CursorPoint.X < AmmoRect.x then//check left 
-        CursorPoint.X:= AmmoRect.x;
+    if CursorPoint.X < AmmoRect.x + AMSlotSize then//check left
+        CursorPoint.X:= AmmoRect.x + AMSlotSize;
     if CursorPoint.X > AmmoRect.x + AmmoRect.w then//check right
         CursorPoint.X:= AmmoRect.x + AmmoRect.w;
     if CursorPoint.Y > cScreenHeight - AmmoRect.y then//check top