From 9c855d16f1a737ddd9bde72e0fc51f4fd0a1e042 Mon Sep 17 00:00:00 2001 From: Mario Kilies Date: Fri, 14 Jan 2011 04:32:35 +0100 Subject: Implemented hand_sort(). ui_choose_card() now pre-selects the card with lowest index, if at index 0 is no card. draw_card() now draws empty placeholder cards, to clear old screen content. --- src/hand.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/hand.c (limited to 'src/hand.c') diff --git a/src/hand.c b/src/hand.c new file mode 100644 index 0000000..8c2a392 --- /dev/null +++ b/src/hand.c @@ -0,0 +1,16 @@ +#include "hand.h" +#include +#include "card.h" + +static int hand_comparator(const void *a, const void *b) +{ + card c1 = *(card *)a; + card c2 = *(card *)b; + + return c1 - c2; +} + +void hand_sort(hand h) +{ + qsort(h, MAX_HAND_CARDS, sizeof(card), hand_comparator); +} -- cgit v1.2.3