summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-03-26 18:21:48 -0400
committerJune McEnroe <june@causal.agency>2019-03-26 18:21:48 -0400
commit5645043c86bf5df846078f2bcacbc881e4021619 (patch)
treec3899a243523dd21b87570e435f644e588ee023c
parentRemove stackDeck (diff)
downloadwep-5645043c86bf5df846078f2bcacbc881e4021619.tar.gz
wep-5645043c86bf5df846078f2bcacbc881e4021619.zip
Make Stack capacity configurable
Allows games to use multiple decks.
-rw-r--r--stack.h8
1 files 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;
 }
 
g'> In other words, warn when a function is missing static. I don't see why this isn't in -Wextra. 2022-02-19Fix edit.[ch] license notice additional permissionsJune McEnroe 2022-02-19Run line editing testsJune McEnroe I know, it feels wrong. 2022-02-18Implement new line editing "library"June McEnroe Losing tab complete and text macros, for now. This new implementation works on an instance of a struct and does not interact with the rest of catgirl, making it possible to copy into another project. Unlike existing line editing libraries, this one is entirely abstract and can be rendered externally. My goal with this library is to be able to implement vi mode. Since it operates on struct instances rather than globals, it might also be possible to give catgirl separate line editing buffers for each window, which would be a nice UX improvement. 2022-02-18Simplify cursor positioning in inputJune McEnroe Do some extra work by adding the portion before the cursor to the input window twice, but simplify the interaction with the split point. This fixes the awkward behaviour when moving the cursor across colour codes where the code would be partially interpreted up to the cursor. 2022-02-18Fix M-f orderingJune McEnroe 2022-02-12Move sandman build to scripts/MakefileJune McEnroe 2022-02-12Use compat_readpassphrase.c on LinuxJune McEnroe 2022-02-12Copy RPP defines from oconfigureJune McEnroe