aboutsummaryrefslogtreecommitdiff
path: root/ai.c
diff options
context:
space:
mode:
authorNathan Vance <nathav63@gmail.com>2015-03-12 12:41:29 -0400
committerNathan Vance <nathav63@gmail.com>2015-03-12 12:41:29 -0400
commitcb11d841ecea5c55df6a73bff33eaac7cf477861 (patch)
tree8ba3b8293bd53369e7e2672e6bde4d1b1047b6ff /ai.c
parentFixed bug with data_potentialvps (diff)
download7w-cb11d841ecea5c55df6a73bff33eaac7cf477861.tar.gz
7w-cb11d841ecea5c55df6a73bff33eaac7cf477861.tar.bz2
7w-cb11d841ecea5c55df6a73bff33eaac7cf477861.zip
Now cannot buy two of the same card
Diffstat (limited to 'ai.c')
-rw-r--r--ai.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ai.c b/ai.c
index 7bb9f86..1eb8c11 100644
--- a/ai.c
+++ b/ai.c
@@ -15,6 +15,7 @@ int weight_buildcard(int era, int card, int player);
int weight_buildwonder(int player);
int* cards_getproduction(int era, int card);
int* cards_getcost(int era, int card);
+int data_hasbuiltname(int p, int era, int card);
int* ai_bestcard(int *hand, int player) //return card
{
@@ -23,7 +24,7 @@ int* ai_bestcard(int *hand, int player) //return card
int card = 0;
for(i = 0; hand[i] != -1 && i < 7; i++) {
temp = weight_buildcard(data_getera(), hand[i], player);
- if(! data_canafford(player, data_getera(), hand[i]))
+ if(! data_canafford(player, data_getera(), hand[i]) || data_hasbuiltname(player, data_getera(), hand[i]))
temp = 0;
if(temp > max) {
max = temp;
bgstack15