diff options
author | Nathan Vance <nathav63@gmail.com> | 2015-03-11 22:31:44 -0400 |
---|---|---|
committer | Nathan Vance <nathav63@gmail.com> | 2015-03-11 22:31:44 -0400 |
commit | 1a39ccc3088dd3fbc6da9571a17060cc50f432e4 (patch) | |
tree | f8e4973ac8044535d64526f2281b8953484e261a /player_turn.c | |
parent | Implemented basic ai (diff) | |
download | 7w-1a39ccc3088dd3fbc6da9571a17060cc50f432e4.tar.gz 7w-1a39ccc3088dd3fbc6da9571a17060cc50f432e4.tar.bz2 7w-1a39ccc3088dd3fbc6da9571a17060cc50f432e4.zip |
Squelched some bugs, more to go!
Diffstat (limited to 'player_turn.c')
-rw-r--r-- | player_turn.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/player_turn.c b/player_turn.c index bd9e805..a7d13d2 100644 --- a/player_turn.c +++ b/player_turn.c @@ -10,6 +10,9 @@ void data_discard(int p, int card); void data_buildwonder(int p, int card); void data_addgold(int amnt, int p); int data_numcards(int p); +int data_canafford(int p, int era, int card); +int data_getwonder(int p); +int data_getnextwonderstage(int p); int view_refresh(int focus, int cursor, int player); int wonder_numstages(int player); int* cards_getcost(int era, int card); @@ -28,7 +31,7 @@ int player_build(int focus, int cursor, int player) if(hand[cursor] == -1) return 0; int choice = postoptions(62, 20); if(choice == 0) { - if(data_canafford(player, cards_getcost(data_getera(), hand[cursor]))) { + if(data_canafford(player, data_getera(), hand[cursor])) { data_build(player, hand[cursor]); return 1; } @@ -38,10 +41,11 @@ int player_build(int focus, int cursor, int player) data_addgold(3, player); return 1; } else if(choice == 2) { - if(data_canafford(player, cards_getcost(data_getwonder(player), data_getwonderside(player)*3+1+cursor))) { + if(data_canafford(player, data_getwonder(player), data_getnextwonderstage(player))) { data_buildwonder(player, hand[cursor]); return 1; } + else postmessage("Can't afford this!"); } } return 0; |