From 20d68a6f3de992a88e440cd20b8ee078abd69834 Mon Sep 17 00:00:00 2001 From: Murilo Pereira Date: Sun, 1 May 2011 02:05:35 -0300 Subject: [PATCH] Only traverse maneuvre stacks for drawing. --- lib/display.c | 17 +++++++++-------- lib/game.c | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/display.c b/lib/display.c index 5782709..2851349 100644 --- a/lib/display.c +++ b/lib/display.c @@ -199,15 +199,16 @@ void draw_card(struct card *card) { void draw_stack(struct stack *stack) { if (!empty(stack)) { - struct stack *iterator = stack->next; - while (iterator != NULL) { - draw_card(iterator->card); - iterator = iterator->next; - } - draw_card(stack->card); - } + if (maneuvre_stack(stack)) { + struct stack *reversed_stack = reverse(stack); - return; + for (struct stack *i = reversed_stack; i; i = i->next) { + draw_card(i->card); + } + } else { + draw_card(stack->card); + } + } } void draw_deck(struct deck *deck) { diff --git a/lib/game.c b/lib/game.c index 8415631..c2d9d2a 100644 --- a/lib/game.c +++ b/lib/game.c @@ -8,7 +8,7 @@ #include "util.h" #include "game.h" -static bool maneuvre_stack(struct stack *stack) { +bool maneuvre_stack(struct stack *stack) { return(stack->card->frame->start_y >= MANEUVRE_STACKS_STARTING_Y); }