about summary refs log tree commit diff
path: root/sol.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-03-24 21:31:32 -0400
committerJune McEnroe <june@causal.agency>2019-03-24 21:31:32 -0400
commit3034a0dfd9aa1e687a2619167569bddc37fb5d50 (patch)
treec0dd917b83cfaaf5ee005b4e90889a8d7131d268 /sol.c
parentUse SDL2_PREFIX as make variable (diff)
downloadcards-3034a0dfd9aa1e687a2619167569bddc37fb5d50.tar.gz
cards-3034a0dfd9aa1e687a2619167569bddc37fb5d50.zip
Fix gcc sign warnings
Diffstat (limited to '')
-rw-r--r--sol.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sol.c b/sol.c
index 1933716..b4a323f 100644
--- a/sol.c
+++ b/sol.c
@@ -117,7 +117,7 @@ static bool gameAvail(Card card) {
 	if (card < 0) return false;
 	if (!gameFind(&stack, &index, card)) return false;
 
-	bool top = (index == stacks[stack].len - 1);
+	bool top = (card == stackTop(&stacks[stack]));
 	if (stack == Waste1) {
 		return top && !stacks[Waste3].len;
 	} else if (stack == Waste3) {
@@ -135,7 +135,7 @@ static bool gameReveal(Card card) {
 	uint stack, index;
 	if (!gameFind(&stack, &index, card)) return false;
 	if (stack < Tableau1 || stack > Tableau7) return false;
-	if (index != stacks[stack].len - 1) return false;
+	if (card != stackTop(&stacks[stack])) return false;
 	if (card > 0) return false;
 	gameDo(stackFlipTo, stack, stack, 1);
 	return true;
@@ -247,7 +247,8 @@ static void layoutCard(struct List **list, SDL_Rect *rect, Card card) {
 		*list = &layout.drag;
 		*rect = layout.dragItem.rect;
 	}
-	struct Item item = { *rect, (card > 0 ? card : layout.backTexture), card };
+	uint texture = (card > 0 ? (uint)card : layout.backTexture);
+	struct Item item = { *rect, texture, card };
 	listPush(*list, item);
 }