diff options
-rw-r--r-- | data.c | 25 | ||||
-rw-r--r-- | view.c | 12 | ||||
-rw-r--r-- | wonder.c | 3 |
3 files changed, 38 insertions, 2 deletions
@@ -3,6 +3,7 @@ int* getdeck(int era, int numplayers); int* cards_getproduction(int era, int card); +int cards_gettype(int era, int card); int* get_intarray(int size); void array_cpy(int *a, int *b, int len); //copies b to a void shuffle(int *deck, int n); @@ -27,14 +28,14 @@ void data_nextera() hands[i][j] = decks[era][k++]; } -void data_distributewonders(int n) +void data_distributewonders() { int i; int wonders[7]; for(i = 0; i < 7; i++) wonders[i] = i+3; //wonders are numbered 3-9 shuffle(wonders, 7); - for(i = 0; i < n; i++) { + for(i = 0; i < numplayers; i++) { player[i][3][0] = wonders[i]; player[i][3][1] = rand()%2; } @@ -101,6 +102,11 @@ int data_getwonderstages(int p) return player[p][3][2]; } +int data_numplayers() +{ + return numplayers; +} + void data_build(int p, int card) { int i; @@ -203,3 +209,18 @@ int data_canafford(int p, int *cost) if(data_iszerocost(cost)) return 2; return recurse(cost, data_getindefinites(p)); } + +int* data_getbuilt(int p) +{ + int *ret = get_intarray(42); + int type, e, c; + int i = 0; + for(type = 0; type <= 7; type++) + for(e = 0; e < 3; e++) + for(c = 0; c < 7; c++) + if(cards_gettype(e, player[p][e][c]) == type) { + ret[i++] = e; + ret[i++] = player[p][e][c]; + } + return ret; +} @@ -0,0 +1,12 @@ +#include "7w.h" + +void print_wonder(int x, int y, int player, int cursor); +void io_printcard(int x, int y, int era, int card); +void io_printhand(int x, int y, int player, int cursor); +void io_clearscreen(); +int data_numplayers(); + +void view_refresh(int focus, int cursor) +{ + +} @@ -4,6 +4,8 @@ int* cards_getcost(int wonder, int stage); //remember the stage offset! int* cards_getproduction(int wonder, int stage); char* cards_getname(int wonder, int stage); //stage should always be 0 char* cards_specialmessage(int wonder, int stage); +char* getname(int res); +int cards_gettype(int wonder, int stage); //stage is 0 int data_getwonder(int p); int data_getwonderside(int p); void io_printborder(int x, int y); @@ -30,6 +32,7 @@ void print_wonder(int x, int y, int player, int cursor) { io_printborder(x, y++); y = io_printtext(x, y, 29, cards_getname(data_getwonder(player), 0)); + y = io_printtext(x, y, 29, cat("Produces 1 ", getname(cards_gettype(data_getwonder(player), 0)))); int i; for(i = 0; wonder_hasstage(data_getwonder(player), data_getwonderside(player), i); i++) { char *text = cat("Stage ", itoa(i+1)); |