aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-04-11 00:36:45 +0300
committereug-vs <eugene@eug-vs.xyz>2022-04-11 00:36:45 +0300
commita6dc21034a55be0a9c1910787d615b5bca7131c6 (patch)
tree90dd29b77d2cd27b7a3f72754b7bfccc6577d88f /src/main.c
parentca745926cf181e1aee026c48335543610f60770e (diff)
downloadcarcassonne-engine-c-a6dc21034a55be0a9c1910787d615b5bca7131c6.tar.gz
refactor: divide code into modules
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c31
1 files changed, 2 insertions, 29 deletions
diff --git a/src/main.c b/src/main.c
index 888763d..34524a6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <curses.h>
#include <time.h>
-#include "board.h"
+#include "carcassonne.h"
int get_player_color(int player) {
return player ? COLOR_PAIR(player + 2) : COLOR_PAIR(0);
@@ -57,33 +57,6 @@ int main() {
Tile tile = { "FRCR", 'R', 0 };
place_tile(tile, translate_coordinate(BOARD_WIDTH * BOARD_WIDTH / 2), board, 1);
- Tile tileset[19] = {
- /* cities */
- { "FFFF", 'F', 0 },
- { "CFFF", 'F', 0 },
- { "FCFC", 'C', 0 },
- { "FCFC", 'F', 0 },
- { "CCFF", 'C', 0 },
- { "CCFF", 'F', 0 },
- { "CCCF", 'C', 0 },
- { "CCCC", 'C', 0 },
-
- /* roads */
- { "FFFR", 'R', 0 },
- { "FRFR", 'R', 0 },
- { "FFRR", 'R', 0 },
- { "FRRR", '+', 0 },
- { "RRRR", '+', 0 },
-
- /* mix */
- { "CRFR", 'R', 0 },
- { "CFRR", 'R', 0 },
- { "CRRF", 'R', 0 },
- { "CRRR", '+', 0 },
- { "CCRR", '*', 0 },
- { "CCCR", 'C', 0 },
- };
-
/* main loop */
char input_key;
for (int move = 0; ; move++) {
@@ -93,7 +66,7 @@ int main() {
draw_board(board, meeple_map, board_win);
/* tile placement */
- tile = tileset[rand() % 19];
+ tile = TILESET[rand() % 19];
int position = 0;
BoardUnit board_preview[BOARD_UNITS];