summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-04-03 15:19:06 -0400
committerJune McEnroe <june@causal.agency>2019-04-03 15:19:06 -0400
commit167658ec624079c3912581e6721ad408a1a2a2f0 (patch)
treec13e41cf24e269e97cae3696a64df706f6da68f5
parentCheck gameAvail on double-click (diff)
downloadwep-167658ec624079c3912581e6721ad408a1a2a2f0.tar.gz
wep-167658ec624079c3912581e6721ad408a1a2a2f0.zip
Tweak mouseButtonUp code a bit
It's still kind of confusing.
Diffstat (limited to '')
-rw-r--r--freecell.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/freecell.c b/freecell.c
index f6562b8..da8729d 100644
--- a/freecell.c
+++ b/freecell.c
@@ -275,18 +275,18 @@ static bool mouseButtonDown(SDL_MouseButtonEvent button) {
 }
 
 static bool mouseButtonUp(SDL_MouseButtonEvent button) {
+	struct SDL_Point point = { button.x, button.y };
+
 	if (button.button == SDL_BUTTON_RIGHT) {
 		if (!reveal.len) return false;
 		reveal.len = 0;
 		return true;
 	}
 
-	struct SDL_Point point = { button.x, button.y };
-	struct Item *item = listFind(&layout.main, &point);
-
 	if (button.clicks % 2 == 0) {
 		Card card = layout.dragItem.card;
 		if (!card) {
+			struct Item *item = listFind(&layout.main, &point);
 			if (!item) return false;
 			card = item->card;
 		}
@@ -308,6 +308,7 @@ static bool mouseButtonUp(SDL_MouseButtonEvent button) {
 		return true;
 	}
 
+	struct Item *item = listFind(&layout.main, &point);
 	if (!item) return false;
 	if (!gameAvail(item->card)) return false;
 	layout.dragItem = *item;