From 4b9e56ebf47db8be740f4ff2a4b9fceb9f143055 Mon Sep 17 00:00:00 2001 From: Mario Kilies Date: Sun, 16 Jan 2011 08:41:04 +0100 Subject: 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. --- src/card_stack.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/card_stack.c (limited to 'src/card_stack.c') 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 +#include + +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; +} -- cgit v1.2.3