Complete.Org: Mailing Lists: Archives: freeciv-ai: April 2002:
[freeciv-ai] Re: Slimmer Corecleaups

[freeciv-ai] Re: Slimmer Corecleaups

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Cc: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>, freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] Re: Slimmer Corecleaups
From: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Date: Sun, 21 Apr 2002 18:17:47 -0400

At 01:05 AM 02/04/20 -0700, Raahul Kumar wrote:
>--- "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx> wrote:
>> If you drive you have control over the destination, that's fine with me :-)
>Can I ask for some help? I'm sending in this email a patch containing just
>AI bits. Can you remove everything that depends on your new co-ordinate
>I want to make this patch compile. Later on I'll rip out your ocean code and
>the waste implementation. That should leave your co-ordinate system by

I think you will find that the core elements of the coordinate system are
all in map.{c,h}, city.{c,h} with a bit in tilespec.{c,h}. Except where 
there are new macros, the existing code pretty much works with either 
array-based or rotational definitions, and it doesn't matter if you use
macros or functions if you leave the names the same. What this means is
that there is virtually no overlap except for a couple obvious exceptions.

Interfaces are wonderful things if done right. You can switch the underlying 
implementation and all you see are the benefits :-).

The topology fixes add native coordinate conversions, but for CVS the
native functions are all just identity operations and can be dropped or
masked out with a trivial reassignment macro. Most of the topology stuff
is in a few server locations like savegame.c and of course the client
display code.

I don't think there was anything to change in the ai subset you cut out
in these regards (at least on a quick scan and grep).

But you do need to be careful ...

You do want to not take the set_unit_activity() priority fixes without 
picking up common and server changes as well. It is best to just edit the 
diffs to remove these changes for now. Do something like this ...

+        set_unit_activity(aunit, ACTIVITY_SENTRY, -1);
+        if (bodyguard)
+         set_unit_activity(bodyguard, ACTIVITY_SENTRY, -1);
-        set_unit_activity(aunit, ACTIVITY_SENTRY);
-        if (bodyguard) set_unit_activity(bodyguard, ACTIVITY_SENTRY);
         set_unit_activity(aunit, ACTIVITY_SENTRY);
+        if (bodyguard)
+         set_unit_activity(bodyguard, ACTIVITY_SENTRY);
-        if (bodyguard) set_unit_activity(bodyguard, ACTIVITY_SENTRY);

There are in general changes in common and server for most of the ai
patches. For example you need to add the new want elements to various
structs in common, and make sure they are (re)set properly in places like 
server/cityturn.c if you really want to get everything right.

You will find I reordered a number of structs in common. Collecting the
bool values in a single block reduces a lot of the alignment noise and
padding issues, for instance.

And if you take the code in ai_find_elvis_pos() you probably want to make
sure you take the corresponding changes in server/cityturn.c:worker_loop()
to keep the two in sync.

+Find the least effective worker (i.e. to make into an elvis).
+This routine should mimic server/cityturn.c:worker_loop().
+TODO: buildin AI personalities through "want" elements.
 static int ai_find_elvis_pos(struct city *pcity, int *xp, int *yp)

Changes to manage_explorers() and manage_ferryboats depend on having
GB's dynamic warmap code in server/gotohand.c. Also a number of fixes
to various core routines where the new code exposes bugs that CVS
doesn't really exercise (yet).

>Of course, just because we've heard a spine-chilling, blood-curdling
scream of
>the sort to make your very marrow freeze in your bones doesn't automatically
>mean there's anything wrong."
>{Soul Music, 1994}
>Do You Yahoo!?
>Yahoo! Games - play chess, backgammon, pool and more
>Attachment Converted: "c:\program files\eudora\attach\rossai.diff.gz"


[Prev in Thread] Current Thread [Next in Thread]