Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2001:
[Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068)
Home

[Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068)
From: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Date: Tue, 4 Dec 2001 16:00:05 +0000 (GMT)

 --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> On Mon, Dec 03, 2001 at 04:54:08PM +0000, Gregory Berkolaiko wrote:
> > So you propose:
> > 1. Generate city land warmap, evaluate all land enemy units
> > 2. Generate city sea warmap, evaluate all marine enemy units
> > ?
> 
> Yes.
> 
> > This will take exactly the same amount of time.
> 
> Good.
> 
> > There will be problems like "what if this howitzer over there takes
> > a boat?", but it is not fatal.
> 
> Does the current code handle this case right?

It tries.

> > But the amount of work needed to make such separation and the
> > resultant patch would be huge.
> 
> But this is a real cleanup. Or how would you call it?

I would call it much ado about nothing, since it doesn't facilitate the
use of warmap and doesn't speed anything up.  And it is MUCH work to
trace calls to warmap throughout the code and understand which warmap
they are actually refering to.

BTW, can it be done automatically, I mean whenever warmap.cost is used,
print a log message with the file:line info?

There is one step on the road to tightening interface, that I think is
worth taking.  There are 2 functions, really_generate_warmap and
generate_warmap (which is a wrapper for really_generate_warmap, doing
some initialisations).  Unfortunately, due to objective reasons (see
below), really_generate_warmap is also called directly from the code,
making it difficult to understand which initialisation should go where. 
One should probably unify it.

The "exceptional" warmap are generated when AI wants to know 
"where unit A will be able to go when it comes to city X?"
that is it needs a warmap with initial coordinates in X but with
move_type of A.

G.


________________________________________________________________
Nokia 5510 looks weird sounds great. 
Go to http://uk.promotions.yahoo.com/nokia/ discover and win it! 
The competition ends 16 th of December 2001.


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