diff options
author | June McEnroe <june@causal.agency> | 2019-03-22 15:22:10 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-03-22 15:22:10 -0400 |
commit | c4e4d7c76563216b598feba7abc6b9b72df4724b (patch) | |
tree | 85d353f26963a702c17d07f8432db814df4df001 /stack.h | |
parent | Refactor layout code slightly (diff) | |
download | wep-c4e4d7c76563216b598feba7abc6b9b72df4724b.tar.gz wep-c4e4d7c76563216b598feba7abc6b9b72df4724b.zip |
Implement the game
Diffstat (limited to '')
-rw-r--r-- | stack.h | 5 |
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) { |