[freeciv-ai] Re: simple historian agent
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Thu, Mar 25, 2004 at 04:08:06PM -0800, nikodimka wrote:
>
> Raimar,
>
> The majority of your suggestions accepted with thankfull silence.
> Thank you.
> Some require more clarifications.
>
>
> > > strcpy(simple_historian_agent.name, "Simple Historian");
> >
> > strlcpy
>
> What is it? I don't think you mean the cool OpenBSDism.
Yes. Or more precisely the freeciv specific variant: mystrlcpy.
> > > simple_historian_agent.level = 98; /* well which level this should
> > > be to recieve change
> > > notification after all others? */
> >
> > Good question.
>
> I can add
>
> #define DEEPEST_AGENT_LEVEL 99 /* Don't use the last level unless you know
> what you're doing */
>
> into agents.h
>
> and change the line into simple_historian_agent.level = LAST_AGENT_LEVEL;
>
> if you have no better suggestion.
I would call it LAST_AGENT_LEVEL.
> > > void sha_tile_update(int index) {
> > >
> > > int x; int y;
> > >
> > > freelog(LOG_DEBUG, "sha got tile: %d\n", index);
> > >
> > > index_to_map_pos(&x, &y, index);
> > > /* Yes. decode and encode again. I could not find a function :( */
> > > previous_tiles[index] = *map_get_tile(x, y);
> > > }
> >
> > IMHO the agents.c should do the callback with x and y and not with
> > index.
>
> This is because struct call's arg is of int type
> so I am not sure if you plan to extend this to something other type
> like union of possible arg types. Hence on the basis of Occam's razor
> I made it int.
There is no problem adding the callbacks with x and y.
> The second issue is: "in which coordinate system these x,y should
> be?" the "index" allways has well defined meaning whereas x,y is
> something pretty fuzzy as far as I can tell.
Well you can blame Jason ;)
No honestly there is only coordinate system which 95% of the functions
take. I think Jason called it "natural".
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"Heuer's Law: Any feature is a bug unless it can be turned off."
|
|