aboutsummaryrefslogtreecommitdiff
path: root/ai_weights.c
diff options
context:
space:
mode:
authorNathan Vance <nathav63@gmail.com>2015-04-03 19:21:20 -0400
committerNathan Vance <nathav63@gmail.com>2015-04-03 19:21:20 -0400
commite5cc06ddd5e6f725605ccabd312bcd5c5da2aa8c (patch)
tree42fde640ee2a6f3a0e85a74cb364805d8525abc5 /ai_weights.c
parentHalicarnassus bug fixes (diff)
download7w-e5cc06ddd5e6f725605ccabd312bcd5c5da2aa8c.tar.gz
7w-e5cc06ddd5e6f725605ccabd312bcd5c5da2aa8c.tar.bz2
7w-e5cc06ddd5e6f725605ccabd312bcd5c5da2aa8c.zip
Can now see history of previous turn
Diffstat (limited to 'ai_weights.c')
-rw-r--r--ai_weights.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/ai_weights.c b/ai_weights.c
index f614fe9..67fbd8e 100644
--- a/ai_weights.c
+++ b/ai_weights.c
@@ -16,9 +16,11 @@ int get_trade(int player, int type, int direction);
int cards_gettype(int era, int card);
int* get_science(int player);
int* get_special(int era, int card, int player);
+int* get_intarray(int size);
int data_potentialvps(int p, int era, int card);
int data_gettotvps(int p);
int military_might(int player);
+int* ai_trade(int player, int era, int card);
int weight_science(int era, int card, int player)
{
@@ -126,8 +128,19 @@ int weight_buildcard(int era, int card, int player)
return weight;
}
-int weight_buildwonder(int player)
+int* weight_buildwonder(int player)
{
- if(! data_canafford(player, data_getwonder(player), data_getnextwonderstage(player))) return 0;
- return (data_getwonderstages(player)+2) * 2;
+ int *trade = get_intarray(3);
+ static int ret[4];
+ ret[0] = (data_getwonderstages(player)+2) * 2;
+ ret[1] = ret[2] = ret[3] = 0;
+ if(data_canafford(player, data_getwonder(player), data_getnextwonderstage(player)) != 1) {
+ trade = ai_trade(player, data_getwonder(player), data_getnextwonderstage(player));
+ if(trade[2]) ret[0] -= trade[2] / 3;
+ else ret[0] = 0;
+ ret[1] = trade[0];
+ ret[2] = trade[1];
+ ret[3] = trade[2];
+ }
+ return ret;
}
bgstack15