Index: ai/advdomestic.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advdomestic.c,v retrieving revision 1.83 diff -u -r1.83 advdomestic.c --- ai/advdomestic.c 2002/03/18 01:49:36 1.83 +++ ai/advdomestic.c 2002/04/06 12:15:35 @@ -655,9 +655,7 @@ /* Continent where the city is - important for caravans */ int continent = map_get_continent(pcity->x, pcity->y); - choice->choice = 0; - choice->want = 0; - choice->type = CT_NONE; + init_choice(choice); /* Find out desire for settlers */ Index: ai/advmilitary.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/advmilitary.c,v retrieving revision 1.103 diff -u -r1.103 advmilitary.c --- ai/advmilitary.c 2002/04/04 03:51:02 1.103 +++ ai/advmilitary.c 2002/04/06 12:15:36 @@ -946,9 +946,8 @@ struct unit virtualunit; struct city *acity = 0; struct unit *aunit = 0; - choice->choice = 0; - choice->want = 0; - choice->type = CT_NONE; + + init_choice(choice); /* TODO: recognize units that can DEFEND_HOME but are in the field. -- Syela */ Index: ai/aicity.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v retrieving revision 1.113 diff -u -r1.113 aicity.c --- ai/aicity.c 2002/03/29 06:39:47 1.113 +++ ai/aicity.c 2002/04/06 12:15:36 @@ -145,9 +145,7 @@ { struct ai_choice bestchoice, curchoice; - bestchoice.choice = A_NONE; - bestchoice.want = 0; - bestchoice.type = CT_NONE; + init_choice(&bestchoice); if( is_barbarian(pplayer) ) { /* always build best attack unit */ Unit_Type_id i, iunit, bestunit = -1; @@ -299,9 +297,8 @@ if (reserve > pplayer->economic.gold) break; - bestchoice.want = 0; - bestchoice.type = CT_NONE; - bestchoice.choice = 0; + init_choice(&bestchoice); + city_list_iterate(pplayer->cities, acity) if (acity->anarchy != 0) continue; if (acity->ai.choice.want > bestchoice.want && ai_fuzzy(pplayer, TRUE)) { Index: ai/aitools.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aitools.c,v retrieving revision 1.49 diff -u -r1.49 aitools.c --- ai/aitools.c 2002/04/04 03:51:03 1.49 +++ ai/aitools.c 2002/04/06 12:15:37 @@ -96,6 +96,16 @@ } /************************************************************************** + Sets the values of the choice to initial values. +**************************************************************************/ +void init_choice(struct ai_choice *choice) +{ + choice->choice = A_NONE; + choice->want = 0; + choice->type = CT_NONE; +} + +/************************************************************************** ... **************************************************************************/ void adjust_choice(int value, struct ai_choice *choice) Index: ai/aitools.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/ai/aitools.h,v retrieving revision 1.17 diff -u -r1.17 aitools.h --- ai/aitools.h 2002/03/05 10:20:24 1.17 +++ ai/aitools.h 2002/04/06 12:15:37 @@ -25,6 +25,7 @@ int ai_gold_reserve(struct player *pplayer); +void init_choice(struct ai_choice *choice); void adjust_choice(int value, struct ai_choice *choice); void copy_if_better_choice(struct ai_choice *cur, struct ai_choice *best); void ai_advisor_choose_building(struct city *pcity, struct ai_choice *choice);