aboutsummaryrefslogtreecommitdiff
path: root/ai_weights_special.c
diff options
context:
space:
mode:
authorNathan Vance <nathav63@gmail.com>2015-07-27 19:15:59 -0400
committerNathan Vance <nathav63@gmail.com>2015-07-27 19:15:59 -0400
commit06818a49b337ef5d3277ebf6ed0b3f13a88239d3 (patch)
tree500f311c25ac68fc9a3b8429bf0747572e4d3e69 /ai_weights_special.c
parentfixed bugs and formatting errors (diff)
download7w-06818a49b337ef5d3277ebf6ed0b3f13a88239d3.tar.gz
7w-06818a49b337ef5d3277ebf6ed0b3f13a88239d3.tar.bz2
7w-06818a49b337ef5d3277ebf6ed0b3f13a88239d3.zip
Updated to work with gcc 5.X
Diffstat (limited to 'ai_weights_special.c')
-rw-r--r--ai_weights_special.c60
1 files changed, 28 insertions, 32 deletions
diff --git a/ai_weights_special.c b/ai_weights_special.c
index 1168421..1390110 100644
--- a/ai_weights_special.c
+++ b/ai_weights_special.c
@@ -1,41 +1,37 @@
#include "7w.h"
-int* data_gettradables(int p);
-int data_getdir(int dir, int p);
-int data_getgold(int p);
-
//dir 0 is east, 1 is west
-int weight_tradingpost(int dir, int player)
-{
- int weight = 0;
- int *trade = data_gettradables(data_getdir(dir, player));
- int *prod = data_gettradables(player);
- int i;
- for(i = 0; i < CLOTH; i++) {
- if(trade[i] && !prod[i]) weight++;
- }
- return weight;
+int weight_tradingpost(int dir, int player) {
+ int weight = 0;
+ int trade[GOLD + 1];
+ data_gettradables(data_getdir(dir, player), trade);
+ int prod[GOLD + 1];
+ data_gettradables(player, prod);
+ int i;
+ for (i = 0; i < CLOTH; i++) {
+ if (trade[i] && !prod[i])
+ weight++;
+ }
+ return weight;
}
-int weight_marketplace(int player)
-{
- int weight = 0;
- int i, j;
- int prod[GOLD+1];
- arraycpy(data_gettradables(player), prod, GOLD+1);
- int trade[GOLD+1];
- for(i = 0; i < 2; i++) {
- arraycpy(data_gettradables(data_getdir(i, player)), trade, GOLD+1);
- for(j = CLOTH; j <= PAPER; j++) {
- if(trade[j] && !prod[j]) weight++;
- }
- }
- return weight;
+int weight_marketplace(int player) {
+ int weight = 0;
+ int i, j;
+ int prod[GOLD + 1];
+ data_gettradables(player, prod);
+ int trade[GOLD + 1];
+ for (i = 0; i < 2; i++) {
+ data_gettradables(data_getdir(i, player), trade);
+ for (j = CLOTH; j <= PAPER; j++) {
+ if (trade[j] && !prod[j])
+ weight++;
+ }
+ }
+ return weight;
}
-int weight_gold(int gold, int player)
-{
- return gold - data_getgold(player);
+int weight_gold(int gold, int player) {
+ return gold - data_getgold(player);
}
-
bgstack15