From 5645043c86bf5df846078f2bcacbc881e4021619 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Tue, 26 Mar 2019 18:21:48 -0400 Subject: Make Stack capacity configurable Allows games to use multiple decks. --- stack.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/stack.h b/stack.h index b7b018f..61c6fc2 100644 --- a/stack.h +++ b/stack.h @@ -23,6 +23,10 @@ #include "cards.h" +#ifndef STACK_CAP +#define STACK_CAP 52 +#endif + typedef Sint8 Card; static int cardSuit(Card card) { @@ -48,7 +52,7 @@ static int cardRank(Card card) { struct Stack { Uint8 len; - Card cards[52]; + Card cards[STACK_CAP]; }; static inline void stackClear(struct Stack *stack) { @@ -56,7 +60,7 @@ static inline void stackClear(struct Stack *stack) { } static inline void stackPush(struct Stack *stack, Card card) { - assert(stack->len < 52); + assert(stack->len < STACK_CAP); stack->cards[stack->len++] = card; } -- cgit 1.4.1