aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Vance <nathav63@gmail.com>2015-03-12 10:34:15 -0400
committerNathan Vance <nathav63@gmail.com>2015-03-12 10:34:15 -0400
commit880b62790774e46c388a47a5cd06dfe5b15aef2c (patch)
treebe82cbf131c26804aa74883e723b5002f1f77408
parentBug fixes (diff)
download7w-880b62790774e46c388a47a5cd06dfe5b15aef2c.tar.gz
7w-880b62790774e46c388a47a5cd06dfe5b15aef2c.tar.bz2
7w-880b62790774e46c388a47a5cd06dfe5b15aef2c.zip
Fixed bug with data_potentialvps
-rw-r--r--ai_weights.c5
-rw-r--r--data.c8
-rw-r--r--main.c2
3 files changed, 9 insertions, 6 deletions
diff --git a/ai_weights.c b/ai_weights.c
index d559c0c..f614fe9 100644
--- a/ai_weights.c
+++ b/ai_weights.c
@@ -17,6 +17,7 @@ int cards_gettype(int era, int card);
int* get_science(int player);
int* get_special(int era, int card, int player);
int data_potentialvps(int p, int era, int card);
+int data_gettotvps(int p);
int military_might(int player);
int weight_science(int era, int card, int player)
@@ -112,9 +113,7 @@ int weight_buildcard(int era, int card, int player)
{
int weight = data_potentialvps(player, era, card);
weight -= data_gettotvps(player);
- if(cards_gettype(era, card) == STRUCTURE)
- weight *= 3;
- weight /= 2;
+ if(cards_gettype(era, card) == STRUCTURE); //already done
if(cards_gettype(era, card) == MILITARY)
weight += weight_military(era, card, player);
if(era == 2) return weight;
diff --git a/data.c b/data.c
index e3c2cd6..01f96fd 100644
--- a/data.c
+++ b/data.c
@@ -465,10 +465,14 @@ int data_potentialvps(int p, int era, int card)
int i;
for(i = 0; player[p][era][i] != -1; i++); //get free spot in array
player[p][era][i] = card; //build card
- player[i][3][3] += cards_getproduction(era, card)[GOLD];
+ player[p][3][3] += cards_getproduction(era, card)[GOLD];
+ player[p][3][3] += get_special(era, card, p)[1];
+ player[p][3][6] += cards_getproduction(era, card)[VP], p;
int vps = data_gettotvps(p);
+ player[p][3][6] -= cards_getproduction(era, card)[VP], p;
+ player[p][3][3] -= get_special(era, card, p)[1];
+ player[p][3][3] -= cards_getproduction(era, card)[GOLD];
player[p][era][i] = -1;
- player[i][3][3] -= cards_getproduction(era, card)[GOLD];
return vps;
}
diff --git a/main.c b/main.c
index 03f7a18..b629a73 100644
--- a/main.c
+++ b/main.c
@@ -40,7 +40,7 @@ main()
{
io_init();
cards_init();
- data_init(5);
+ data_init(7);
main_routine();
halt();
}
bgstack15