Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2001:
[Freeciv-Dev] PATCH: AI cleanup Version 2

[Freeciv-Dev] PATCH: AI cleanup Version 2

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx, Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Cc: Raahul Kumar <raahul_da_man@xxxxxxxxx>, freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] PATCH: AI cleanup Version 2
From: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Date: Fri, 23 Nov 2001 03:57:54 -0800 (PST)

Added the patch that Raimar sent. I'm almost ready to finish the changes to
the ai. Version 3 will wrap up all changes. This patch applies cleanly
against Nov 20 CVS, the autogames are not changed.

GB: I'm sending you a list of places where the ai has igter code. 

Code that affects igter units

aiunit.c:func ai_military_gothere:835
advmilitary.c:func process_attacker_want:line 580
if (unit_flag(punit, F_IGTER)) d_val /= 1.5;

aiunit.c:func find_something_to_kill:1230
advmilitary.c:func kill_something_with:line 707
if (unit_type_flag(v, F_IGTER)) m *= 3;

line 782

if (unit_flag(pdef, F_IGTER)) dist *= 3;
      if (!dist) dist = 1;

      m = unit_types[v].move_rate;
      if (unit_type_flag(v, F_IGTER)) m *= 3;

Send me any lines I may have missed in the AI referring to the igter units.
Once we have documented all the lines we can change it.

- Document/cleanup AI code. Rename variables to more saying names than these:
  int a, c, d, e, i, a0, b0, f, g, fprime;
  int j, k, l, m, q;

Somewhat fixed in this patch. Ver 3 will fix all the ones I am sure of.

- Unkluge the worst AI kludges. The ones I know of are:
  - on the goto map the move cost of units with F_IGTER is multiplied with 3

I need your help with this Gregory. You need to make the warmap changes.

- the goto map of ships overlap one field onto land

This cannot be fixed. Remove this item from the Todo, the current freeciv
code would need a massive rewrite to do this.

- Replace the use of the value 255 in relation to the warmap with the
  MAXCOST constant.

- Make the server warmap use short instead of char, and raise MAXCOST from
  255 to the maxvalue of a signed short. 

Coming in my next patch.

Raimar, can you appply the warmap patch that GB sent in? It makes changing the
AI and fixing the awful kludges much easier.

Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.

Attachment: aicleanupv2.diff
Description: aicleanupv2.diff

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