Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: [Patch] Cleanup of tile_move_cost_ai
Home

[Freeciv-Dev] Re: [Patch] Cleanup of tile_move_cost_ai

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>, rf13@xxxxxxxxxxxxxxxxxxxxxx, freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: [Patch] Cleanup of tile_move_cost_ai
From: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Date: Sun, 7 Oct 2001 18:41:40 -0700 (PDT)

--- Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx> wrote:
>  --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> > 
> > I thought about using the move_cost field of struct tile for the goto
> > agent. However I had hard time to understand tile_move_cost_ai and the
> > (to me mysterious) -3. The attached patch should allow others not the
> > fall into this.
> 

While you're at it Raimar, how many magic numbers are left in the movement
code?
Are there still 3's that refer to single movement cost as well as something
else? Any chance of enlisting help to finish off all the magic numbers.

> The attached patch shows that you understood it correctly.
> The meaning (my guess) of -3 was
> 1. Minus sign to distinguish from land moving
> 2. 3 == SINGLE_MOVE for sea units
> 

My guess is that -3 was meant to indicate moving to/from a costal city. I
failed to see the need, wasn't it just as easy to check if a city exists at
(x,y) co-ords?

> However you and Raahul are right, property (2) is never used.
> 
> While you are hacking into tile_move_cost_ai, maybe you can think about
> the following:
> separate move_cost into sea_move_cost and land_move_cost with the
> following properties:
> 
> land_move_cost is 
> 1. the same as move_cost between two land tiles,
> 2. MAXCOST between two ocean tiles and land -> sea
Is that the current behaviour? I'm not sure it costs MAXCOST for a marine to
disembark, can someone confirm?

> 3. landing cost for sea -> land
>

I agree with all this, seems to work well. 
> sea_move_cost is
> 1. SINGLE_MOVE for all allowed moves (sea <-> sea and sea <-> city)
> 2. MAXCOST for the rest.
> 
> This would speed up the warmap generation a fair bit and will be
> generally easier to comprehend.
> 
> I am planning to do it myself some time but it is hard to me to judge the
> impact of the change to the code outside goto stuff.
>

It all seems to be correct.
 
> Best,
> G.
> 
> > 
> > It doesn't change any behavior. Well at least I hope so ;)
> > 
> >     Raimar
> 
> 
> ____________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
> or your free @yahoo.ie address at http://mail.yahoo.ie
> 


__________________________________________________
Do You Yahoo!?
NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1


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