diff --git a/src/deck.c b/src/deck.c index 0700104..1340949 100644 --- a/src/deck.c +++ b/src/deck.c @@ -6,7 +6,7 @@ #include "deck.h" #include "common.h" -void allocate_deck(struct deck **deck) { +void deck_malloc(struct deck **deck) { if (!(*deck = malloc(sizeof(**deck)))) { fprintf(stderr, tty_solitaire_error_message(errno, __FILE__, __LINE__)); exit(errno); @@ -21,7 +21,7 @@ void allocate_deck(struct deck **deck) { } } -void initialize_deck(struct deck *deck) { +void deck_init(struct deck *deck) { stack_init(deck->stock); stack_init(deck->waste_pile); for (int i = 0; i < FOUNDATION_STACKS_NUMBER; i++) { @@ -32,7 +32,7 @@ void initialize_deck(struct deck *deck) { } } -void free_deck(struct deck *deck) { +void deck_free(struct deck *deck) { stack_free(deck->stock); stack_free(deck->waste_pile); for (int i = 0; i < FOUNDATION_STACKS_NUMBER; i++) { diff --git a/src/deck.h b/src/deck.h index e20fde0..e44892d 100644 --- a/src/deck.h +++ b/src/deck.h @@ -13,8 +13,8 @@ struct deck { struct stack *maneuvre[MANEUVRE_STACKS_NUMBER]; }; -void allocate_deck(struct deck **); -void initialize_deck(struct deck *); -void free_deck(struct deck *); +void deck_malloc(struct deck **); +void deck_init(struct deck *); +void deck_free(struct deck *); #endif diff --git a/src/game.c b/src/game.c index a644797..5008ead 100644 --- a/src/game.c +++ b/src/game.c @@ -180,8 +180,8 @@ static void deal_cards(struct deck *deck) { void game_init() { allocate_cursor(&cursor); initialize_cursor(cursor); - allocate_deck(&deck); - initialize_deck(deck); + deck_malloc(&deck); + deck_init(deck); /* Setting initial stacks' coordinates. */ set_frame(deck->stock->card->frame, STOCK_BEGIN_Y, STOCK_BEGIN_X); @@ -203,7 +203,7 @@ void game_init() { void game_end() { free_cursor(cursor); - free_deck(deck); + deck_free(deck); } bool game_won() {