summaryrefslogtreecommitdiff
path: root/src/card_stack.c
diff options
context:
space:
mode:
authorMario Kilies <MarioKilies@GMX.net>2011-01-16 08:41:04 +0100
committerMario Kilies <MarioKilies@GMX.net>2011-01-16 08:41:04 +0100
commit4b9e56ebf47db8be740f4ff2a4b9fceb9f143055 (patch)
treed6a31f6e068914a2ec1820da594c9d1c5ea2604e /src/card_stack.c
parentfac5e3de0929c3abb73da552efbda6d641136588 (diff)
Refactored cardstack and tablestacks to card_stack_t and table_stacks_t, that both now are defined as structs rather than arrays. Inserted lots of assert() calls to functions that take pointers as arguments.
Diffstat (limited to 'src/card_stack.c')
-rw-r--r--src/card_stack.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/card_stack.c b/src/card_stack.c
new file mode 100644
index 0000000..206a9d8
--- /dev/null
+++ b/src/card_stack.c
@@ -0,0 +1,18 @@
+#include "card_stack.h"
+#include <assert.h>
+#include <stdlib.h>
+
+uint32_t card_stack_get_points(const card_stack_t *cs)
+{
+ assert(cs != NULL);
+
+ uint32_t points = 0;
+
+ for(uint8_t i = 0; i < MAX_CARD_STACK_SIZE; i++)
+ {
+ if(cs->cards[i] > 0)
+ points += card_get_points(cs->cards[i]);
+ }
+
+ return points;
+}