Declaring local functions as static.
This commit is contained in:
+19
-19
@@ -6,6 +6,25 @@
|
||||
#include <errno.h>
|
||||
#include "stack.h"
|
||||
|
||||
static bool maneuvre_stack(struct stack *stack) {
|
||||
return(stack->card->frame->start_y >= MANEUVRE_STACKS_STARTING_Y);
|
||||
}
|
||||
|
||||
static bool waste_pile_stack(struct stack *stack) {
|
||||
return((stack->card->frame->start_x == WASTE_PILE_STARTING_X) &&
|
||||
(stack->card->frame->start_y == WASTE_PILE_STARTING_Y));
|
||||
}
|
||||
|
||||
static void refresh_card_coordinates(struct stack *origin, struct stack *destination) {
|
||||
origin->card->frame->start_x = destination->card->frame->start_x;
|
||||
origin->card->frame->start_y = destination->card->frame->start_y;
|
||||
if (!empty(destination) && maneuvre_stack(destination)) {
|
||||
origin->card->frame->start_y++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void allocate_stack(struct stack **stack) {
|
||||
if (!(*stack = malloc(sizeof(**stack)))) {
|
||||
fprintf(stderr, "%s: %s (%s:%d)\n", program_name, strerror(errno), __FILE__, __LINE__ - 1);
|
||||
@@ -85,25 +104,6 @@ struct stack *pop(struct stack **stack) {
|
||||
return(popped_entry);
|
||||
}
|
||||
|
||||
bool maneuvre_stack(struct stack *stack) {
|
||||
return(stack->card->frame->start_y >= MANEUVRE_STACKS_STARTING_Y);
|
||||
}
|
||||
|
||||
bool waste_pile_stack(struct stack *stack) {
|
||||
return((stack->card->frame->start_x == WASTE_PILE_STARTING_X) &&
|
||||
(stack->card->frame->start_y == WASTE_PILE_STARTING_Y));
|
||||
}
|
||||
|
||||
void refresh_card_coordinates(struct stack *origin, struct stack *destination) {
|
||||
origin->card->frame->start_x = destination->card->frame->start_x;
|
||||
origin->card->frame->start_y = destination->card->frame->start_y;
|
||||
if (!empty(destination) && maneuvre_stack(destination)) {
|
||||
origin->card->frame->start_y++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void move_card(struct stack **origin, struct stack **destination) {
|
||||
struct stack *stack = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user