summary refs log tree commit diff
path: root/stack.h
diff options
context:
space:
mode:
Diffstat (limited to 'stack.h')
-rw-r--r--stack.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/stack.h b/stack.h
index 46b9091..e85c43f 100644
--- a/stack.h
+++ b/stack.h
@@ -39,6 +39,11 @@ static inline Sint8 stackPop(struct Stack *stack) {
 	return stack->cards[--stack->len];
 }
 
+static inline Sint8 stackTop(struct Stack *stack) {
+	if (!stack->len) return 0;
+	return stack->cards[stack->len - 1];
+}
+
 static inline void stackFlipTo(struct Stack *dst, struct Stack *src, Uint8 n) {
 	if (n > src->len) n = src->len;
 	for (Uint8 i = 0; i < n; ++i) {