aboutsummaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorNathan Vance <nathav63@gmail.com>2015-04-18 20:32:49 -0400
committerNathan Vance <nathav63@gmail.com>2015-04-18 20:32:49 -0400
commit8458fbece94f2253664fe23324c54374aa2a69e3 (patch)
tree5ce6125caf895a1d73ecd569b15d74e4e311d549 /data.c
parentRestructured end of turn (diff)
download7w-8458fbece94f2253664fe23324c54374aa2a69e3.tar.gz
7w-8458fbece94f2253664fe23324c54374aa2a69e3.tar.bz2
7w-8458fbece94f2253664fe23324c54374aa2a69e3.zip
Fixed bug with spending more gold than in treasury
Diffstat (limited to 'data.c')
-rw-r--r--data.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/data.c b/data.c
index f631e3e..f9a8ba6 100644
--- a/data.c
+++ b/data.c
@@ -570,15 +570,14 @@ int data_iscouponed(int p, int era, int card)
int data_canafford(int p, int era, int card)
{
- int ret;
if(data_iscouponed(p, era, card)) return 1;
int *cost = cards_getcost(era, card);
+ if(cost[GOLD] > data_getgold(p) && p != hasfreebuild) return 0;
int i, j, k;
data_removedefinites(p, cost);
data_removetraded(p, cost);
if(data_iszerocost(cost)) return 1;
- ret = recurse(cost, data_getindefinites(p), 0) && (cost[GOLD] <= data_getgold(p));
- if(ret) return 1;
+ if(recurse(cost, data_getindefinites(p), 0)) return 1;
if(p == hasfreebuild) return 2;
return 0;
}
bgstack15