[freeciv-ai] Re: [Freeciv-Dev] Re: (PR#2518) ai reading from raw memory?
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Mon, 9 Dec 2002, Per I. Mathisen via RT wrote:
> Can you check if the attached patch fixes the problem?
Arrgh - the ai_choice mess is even in the server directory! Use this patch
instead, it should cover all cases.
- Per
Index: ai/advattitude.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advattitude.c,v
retrieving revision 1.5
diff -u -r1.5 advattitude.c
--- ai/advattitude.c 14 Nov 2002 09:14:49 -0000 1.5
+++ ai/advattitude.c 9 Dec 2002 18:18:46 -0000
@@ -31,7 +31,6 @@
void attitude_advisor_choose_tech(struct player *pplayer,
struct ai_choice *choice)
{
- choice->choice = A_NONE;
- choice->want = 0;
/* this function haven't been implemented yet */
+ init_choice(choice);
}
Index: ai/advdomestic.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdomestic.c,v
retrieving revision 1.95
diff -u -r1.95 advdomestic.c
--- ai/advdomestic.c 25 Nov 2002 19:18:08 -0000 1.95
+++ ai/advdomestic.c 9 Dec 2002 18:18:46 -0000
@@ -1008,7 +1008,8 @@
{
struct ai_choice cur;
-
+
+ init_choice(&cur);
ai_advisor_choose_building(pcity, &cur);
/* Allowing buy of peaceful units after much testing. -- Syela */
/* want > 100 means BUY RIGHT NOW */
Index: ai/advforeign.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advforeign.c,v
retrieving revision 1.5
diff -u -r1.5 advforeign.c
--- ai/advforeign.c 14 Nov 2002 09:14:49 -0000 1.5
+++ ai/advforeign.c 9 Dec 2002 18:18:46 -0000
@@ -31,7 +31,6 @@
void foreign_advisor_choose_tech(struct player *pplayer,
struct ai_choice *choice)
{
- choice->choice = A_NONE;
- choice->want = 0;
/* this function haven't been implemented yet */
+ init_choice(choice);
}
Index: ai/advmilitary.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advmilitary.c,v
retrieving revision 1.122
diff -u -r1.122 advmilitary.c
--- ai/advmilitary.c 25 Nov 2002 19:18:08 -0000 1.122
+++ ai/advmilitary.c 9 Dec 2002 18:18:46 -0000
@@ -50,9 +50,8 @@
void military_advisor_choose_tech(struct player *pplayer,
struct ai_choice *choice)
{
- choice->choice = A_NONE;
- choice->want = 0;
/* This function hasn't been implemented yet. */
+ init_choice(choice);
}
/**************************************************************************
Index: ai/advtrade.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advtrade.c,v
retrieving revision 1.5
diff -u -r1.5 advtrade.c
--- ai/advtrade.c 14 Nov 2002 09:14:49 -0000 1.5
+++ ai/advtrade.c 9 Dec 2002 18:18:46 -0000
@@ -30,7 +30,6 @@
***********************************************************************/
void trade_advisor_choose_tech(struct player *pplayer, struct ai_choice
*choice)
{
- choice->choice = A_NONE;
- choice->want = 0;
/* this function haven't been implemented yet */
+ init_choice(choice);
}
Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.129
diff -u -r1.129 aicity.c
--- ai/aicity.c 19 Nov 2002 13:31:07 -0000 1.129
+++ ai/aicity.c 9 Dec 2002 18:18:46 -0000
@@ -149,6 +149,7 @@
struct ai_choice bestchoice, curchoice;
init_choice(&bestchoice);
+ init_choice(&curchoice);
if( is_barbarian(pplayer) ) { /* always build best attack unit */
Unit_Type_id i, iunit, bestunit = -1;
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.199
diff -u -r1.199 cityturn.c
--- server/cityturn.c 25 Nov 2002 19:18:09 -0000 1.199
+++ server/cityturn.c 9 Dec 2002 18:18:47 -0000
@@ -618,6 +618,7 @@
int id=-1;
int want=0;
+ init_choice(&choice);
if (!city_owner(pcity)->ai.control)
ai_eval_buildings(pcity); /* so that ai_advisor is smart even for humans */
ai_advisor_choose_building(pcity, &choice); /* much smarter version -- Syela
*/
Index: server/settlers.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.154
diff -u -r1.154 settlers.c
--- server/settlers.c 4 Dec 2002 13:34:27 -0000 1.154
+++ server/settlers.c 9 Dec 2002 18:18:47 -0000
@@ -1537,7 +1537,7 @@
struct player *pplayer = city_owner(pcity);
struct unit virtualunit;
int want;
- int gx, gy;
+ int gx = 0, gy = 0;
struct unit *ferryboat = NULL; /* dummy */
memset(&virtualunit, 0, sizeof(struct unit));
|
|