about summary refs log tree commit diff
path: root/stack.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stack.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/stack.h b/stack.h
index e85c43f..a635e8c 100644
--- a/stack.h
+++ b/stack.h
@@ -19,6 +19,30 @@
 
 #include <SDL_stdinc.h>
 #include <assert.h>
+#include <stdlib.h>
+
+#include "cards.h"
+
+static Sint8 cardSuit(Sint8 card) {
+	card = abs(card);
+	if (card > Cards_Spade) {
+		return Cards_Spade;
+	} else if (card > Cards_Heart) {
+		return Cards_Heart;
+	} else if (card > Cards_Diamond) {
+		return Cards_Diamond;
+	} else {
+		return Cards_Club;
+	}
+}
+
+static Sint8 cardColor(Sint8 card) {
+	return cardSuit(card) == Cards_Diamond || cardSuit(card) == Cards_Heart;
+}
+
+static Sint8 cardRank(Sint8 card) {
+	return abs(card) - cardSuit(card);
+}
 
 struct Stack {
 	Uint8 len;
s when rendering mdocJune McEnroe 2019-12-18Customize cgit CSSJune McEnroe 2019-12-18Use :target rather than :focus pseudo-classJune McEnroe 2019-12-18Copy cgit auxiliary binaries properlyJune McEnroe 2019-12-18Add git.causal.agency cgit configJune McEnroe 2019-12-18Bail from hi if input is binaryJune McEnroe 2019-12-16Post "cgit setup"June McEnroe