aboutsummaryrefslogtreecommitdiff
path: root/ai.c
diff options
context:
space:
mode:
authorNathan Vance <nathav63@gmail.com>2015-04-29 21:04:29 -0400
committerNathan Vance <nathav63@gmail.com>2015-04-29 21:04:29 -0400
commit61477ba75dd35655f38b3f280cd20cbe43b46d5a (patch)
tree2a234bb75325707c7461ec11bc7a8516cec473da /ai.c
parentFixed ai trying to play cards not in its hand (diff)
download7w-61477ba75dd35655f38b3f280cd20cbe43b46d5a.tar.gz
7w-61477ba75dd35655f38b3f280cd20cbe43b46d5a.tar.bz2
7w-61477ba75dd35655f38b3f280cd20cbe43b46d5a.zip
Fixed bug causing array content to be overwritten
Diffstat (limited to 'ai.c')
-rw-r--r--ai.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ai.c b/ai.c
index 2f78a74..0a0936a 100644
--- a/ai.c
+++ b/ai.c
@@ -20,6 +20,7 @@ int data_hasbuiltname(int p, int era, int card);
int* get_intarray(int size);
int* ai_trade(int player, int era, int card);
void write_trade(int player, int tradel, int trader);
+void arraycpy(int *from, int *to, int len);
void ai_bestcard(int *hand, int player, int *ret)
{
@@ -53,7 +54,8 @@ void ai_bestcard(int *hand, int player, int *ret)
void ai_turn(int player)
{
int bestcard[5];
- int *hand = data_gethand(player);
+ int hand[7];
+ arraycpy(data_gethand(player), hand, 7);
int *wonder = get_intarray(4);
wonder[0] = 0;
int i;
bgstack15