aboutsummaryrefslogtreecommitdiff
path: root/science.c
diff options
context:
space:
mode:
authorNathan Vance <nathav63@gmail.com>2015-02-28 23:21:31 -0500
committerNathan Vance <nathav63@gmail.com>2015-02-28 23:21:31 -0500
commitf0bbfee11a0418064a142101a952c3043dde7351 (patch)
treed5105137ea14d3574b2b16c96d8c320870e18dd9 /science.c
parentCorrectly toggles (diff)
download7w-f0bbfee11a0418064a142101a952c3043dde7351.tar.gz
7w-f0bbfee11a0418064a142101a952c3043dde7351.tar.bz2
7w-f0bbfee11a0418064a142101a952c3043dde7351.zip
Started work on ai
Diffstat (limited to 'science.c')
-rw-r--r--science.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/science.c b/science.c
index 89af807..2d0f323 100644
--- a/science.c
+++ b/science.c
@@ -4,13 +4,13 @@ int* data_getbuilt(int p);
int* cards_getproduction(int era, int card);
int cards_gettype(int era, int card);
int data_hasbuilt(int p, int era, int card);
+int* get_intarray(int size);
-int calc_science(int player, int guildval)
+int* get_science(int player)
{
- int science[3];
+ int *science = get_intarray(3);
int i, j;
for(i = 0; i < 3; i++) science[i] = 0;
- if(guildval != -1) science[guildval]++;
int *built = data_getbuilt(player);
int *prod;
for(i = 0; built[i] != -1; i += 2) {
@@ -21,6 +21,14 @@ int calc_science(int player, int guildval)
}
}
}
+ return science;
+}
+
+int calc_science(int player, int guildval)
+{
+ int i;
+ int *science = get_science(player);
+ if(guildval != -1) science[guildval]++;
int min = science[0];
for(i = 0; i < 3; i++)
if(science[i] < min) min = science[i];
bgstack15