diff --git a/lib/deck.c b/lib/deck.c index 63ad622..8ccfc8a 100644 --- a/lib/deck.c +++ b/lib/deck.c @@ -67,6 +67,50 @@ void delete_deck(struct deck *deck) { return; } +void set_deck_stacks_coordinates(struct deck *deck) { + set_frame(deck->stock->card->frame, + STOCK_STARTING_Y, + STOCK_STARTING_X); + set_frame(deck->waste_pile->card->frame, + WASTE_PILE_STARTING_Y, + WASTE_PILE_STARTING_X); + set_frame(deck->foundation_0->card->frame, + FOUNDATION_0_STARTING_Y, + FOUNDATION_0_STARTING_X); + set_frame(deck->foundation_1->card->frame, + FOUNDATION_1_STARTING_Y, + FOUNDATION_1_STARTING_X); + set_frame(deck->foundation_2->card->frame, + FOUNDATION_2_STARTING_Y, + FOUNDATION_2_STARTING_X); + set_frame(deck->foundation_3->card->frame, + FOUNDATION_3_STARTING_Y, + FOUNDATION_3_STARTING_X); + set_frame(deck->maneuvre_0->card->frame, + MANEUVRE_0_STARTING_Y, + MANEUVRE_0_STARTING_X); + set_frame(deck->maneuvre_1->card->frame, + MANEUVRE_1_STARTING_Y, + MANEUVRE_1_STARTING_X); + set_frame(deck->maneuvre_2->card->frame, + MANEUVRE_2_STARTING_Y, + MANEUVRE_2_STARTING_X); + set_frame(deck->maneuvre_3->card->frame, + MANEUVRE_3_STARTING_Y, + MANEUVRE_3_STARTING_X); + set_frame(deck->maneuvre_4->card->frame, + MANEUVRE_4_STARTING_Y, + MANEUVRE_4_STARTING_X); + set_frame(deck->maneuvre_5->card->frame, + MANEUVRE_5_STARTING_Y, + MANEUVRE_5_STARTING_X); + set_frame(deck->maneuvre_6->card->frame, + MANEUVRE_6_STARTING_Y, + MANEUVRE_6_STARTING_X); + + return; +} + void fill_deck(struct deck *deck) { struct card *card[NUMBER_OF_CARDS]; diff --git a/lib/deck.h b/lib/deck.h index 25531e1..6433a51 100644 --- a/lib/deck.h +++ b/lib/deck.h @@ -5,6 +5,33 @@ #define NUMBER_OF_CARDS 52 +#define STOCK_STARTING_X 1 +#define STOCK_STARTING_Y 1 +#define WASTE_PILE_STARTING_X 9 +#define WASTE_PILE_STARTING_Y 1 +#define FOUNDATION_0_STARTING_X 25 +#define FOUNDATION_0_STARTING_Y 1 +#define FOUNDATION_1_STARTING_X 33 +#define FOUNDATION_1_STARTING_Y 1 +#define FOUNDATION_2_STARTING_X 41 +#define FOUNDATION_2_STARTING_Y 1 +#define FOUNDATION_3_STARTING_X 49 +#define FOUNDATION_3_STARTING_Y 1 +#define MANEUVRE_0_STARTING_X 1 +#define MANEUVRE_0_STARTING_Y 7 +#define MANEUVRE_1_STARTING_X 9 +#define MANEUVRE_1_STARTING_Y 7 +#define MANEUVRE_2_STARTING_X 17 +#define MANEUVRE_2_STARTING_Y 7 +#define MANEUVRE_3_STARTING_X 25 +#define MANEUVRE_3_STARTING_Y 7 +#define MANEUVRE_4_STARTING_X 33 +#define MANEUVRE_4_STARTING_Y 7 +#define MANEUVRE_5_STARTING_X 41 +#define MANEUVRE_5_STARTING_Y 7 +#define MANEUVRE_6_STARTING_X 49 +#define MANEUVRE_6_STARTING_Y 7 + struct deck { struct stack *stock; struct stack *waste_pile; @@ -26,6 +53,7 @@ struct deck { void allocate_deck(struct deck **); void initialize_deck(struct deck *); void delete_deck(struct deck *); +void set_deck_stacks_coordinates(struct deck *); void fill_deck(struct deck *); void shuffle_deck(struct deck *); diff --git a/lib/display.h b/lib/display.h index f0d1fc6..4100c41 100644 --- a/lib/display.h +++ b/lib/display.h @@ -14,33 +14,6 @@ #define RED_ON_WHITE 2 #define WHITE_ON_BLUE 3 -#define STOCK_STARTING_X 1 -#define STOCK_STARTING_Y 1 -#define WASTE_PILE_STARTING_X 9 -#define WASTE_PILE_STARTING_Y 1 -#define FOUNDATION_0_STARTING_X 25 -#define FOUNDATION_0_STARTING_Y 1 -#define FOUNDATION_1_STARTING_X 33 -#define FOUNDATION_1_STARTING_Y 1 -#define FOUNDATION_2_STARTING_X 41 -#define FOUNDATION_2_STARTING_Y 1 -#define FOUNDATION_3_STARTING_X 49 -#define FOUNDATION_3_STARTING_Y 1 -#define MANEUVRE_0_STARTING_X 1 -#define MANEUVRE_0_STARTING_Y 7 -#define MANEUVRE_1_STARTING_X 9 -#define MANEUVRE_1_STARTING_Y 7 -#define MANEUVRE_2_STARTING_X 17 -#define MANEUVRE_2_STARTING_Y 7 -#define MANEUVRE_3_STARTING_X 25 -#define MANEUVRE_3_STARTING_Y 7 -#define MANEUVRE_4_STARTING_X 33 -#define MANEUVRE_4_STARTING_Y 7 -#define MANEUVRE_5_STARTING_X 41 -#define MANEUVRE_5_STARTING_Y 7 -#define MANEUVRE_6_STARTING_X 49 -#define MANEUVRE_6_STARTING_Y 7 - void init_curses(); void draw_empty_stacks(); void initialize_game();