[Freeciv-Dev] Re: Small patch to AI Manage functions
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
A couple of comments from a non-maintainer/non-developer.
The ai is being cleaned up, you should check with the guys working on
it. Petr Baudis <pasky@xxxxxxxxxxxxxxx> is one.
Please use unified diff for patches (i.e. cvs diff -u )
On Thu, Feb 07, 2002 at 12:48:57PM -0600, Zach Garner wrote:
> I'm slowly getting into the freeciv AI.
>
> I've enclosed a small patch based off cvs snapshot from Feb. 7 that
> makes the manage unit functions a little more consistent. It makes two
> changes:
> 1. Individual unit management functions (ai_manage_military, etc)
> determine if they have any moves left instead of making ai_manage_unit
> check that. I feel that ai_manage_unit should simply determine the
> correct unit management function for the particular unit, and let that
> function take care of details.
> 2. I've changed from ai_manage_explorer(unit *) to
> ai_manage_explorer(player *, unit *) to be consistent with other
> ai_manage functions. Before the change, unit_owner(punit) had to be
> computed every time ai_manage_explorer was called.
>
> Zach Garner
> Index: ai/aiunit.c
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v
> retrieving revision 1.162
> diff -r1.162 aiunit.c
> 183c183
> < int ai_manage_explorer(struct unit *punit)
> ---
> > int ai_manage_explorer(struct player *pplayer, struct unit *punit)
> 185d184
> < struct player *pplayer = unit_owner(punit);
> 194a194,195
> > if (!punit->moves_left) return 0; /* can't do anything with no moves */
> >
> 240c241
> < return ai_manage_explorer(punit);
> ---
> > return ai_manage_explorer(pplayer, punit);
> 340c341
> < return ai_manage_explorer(punit);
> ---
> > return ai_manage_explorer(pplayer, punit);
> 1514c1515
> < ai_manage_explorer(punit); /* nothing else to do */
> ---
> > ai_manage_explorer(pplayer, punit); /* nothing else to do */
> 1677c1678
> < ai_manage_explorer(punit);
> ---
> > ai_manage_explorer(pplayer, punit);
> 1743c1744
> < ai_manage_explorer(punit);
> ---
> > ai_manage_explorer(pplayer, punit);
> 1755a1757,1758
> > if (!punit->moves_left) return; /* can't do anything with no moves */
> >
> 1800c1803
> < ai_manage_explorer(punit);
> ---
> > ai_manage_explorer(pplayer, punit);
> 1878d1880
> < if (!punit->moves_left) return; /* can't do anything with no moves */
> 1891d1892
> < if (!punit->moves_left) return; /* can't do anything with no moves */
> 1895,1896c1896
> < if (!punit->moves_left) return; /* can't do anything with no moves */
> < ai_manage_explorer(punit); /* what else could this be? -- Syela */
> ---
> > ai_manage_explorer(pplayer, punit); /* what else could this be? --
> > Syela */
> Index: ai/aiunit.h
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.h,v
> retrieving revision 1.27
> diff -r1.27 aiunit.h
> 29c29
> < int ai_manage_explorer(struct unit *punit);
> ---
> > int ai_manage_explorer(struct player *pplayer, struct unit *punit);
> Index: server/settlers.c
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
> retrieving revision 1.116
> diff -r1.116 settlers.c
> 394a395
> > if (!punit->moves_left) return; /* can't do anything with no moves */
> Index: server/unithand.c
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
> retrieving revision 1.209
> diff -r1.209 unithand.c
> 1259c1259
> < int more_to_explore = ai_manage_explorer(punit);
> ---
> > int more_to_explore = ai_manage_explorer(unit_owner(punit), punit);
> Index: server/unittools.c
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
> retrieving revision 1.150
> diff -r1.150 unittools.c
> 806c806
> < int more_to_explore = ai_manage_explorer(punit);
> ---
> > int more_to_explore = ai_manage_explorer(pplayer, punit);
--
Paul Zastoupil
[Freeciv-Dev] Re: Small patch to AI Manage functions, Petr Baudis, 2002/02/09
|
|