Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2003:
[Freeciv-Dev] Re: (PR#4381) some clean with get_map_tile(...) , get_map_
Home

[Freeciv-Dev] Re: (PR#4381) some clean with get_map_tile(...) , get_map_

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: bursig@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#4381) some clean with get_map_tile(...) , get_map_terrain(...), get_map_special(...) ...
From: "Raimar Falke" <rf13@xxxxxxxxxxxxxxxxx>
Date: Tue, 10 Jun 2003 10:05:56 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Mon, Jun 09, 2003 at 06:43:55AM -0700, Rafa³ Bursig wrote:
> 
> Hi All
> 
> Yesterday I was look into new veteran code and I found that many times 
> in code (not only in veteran code) are call get_map_terrain(...) and 
> get_map_special(...) , map_has_special(...) , etc , even if there is 
> struct tile declared and defined. IMHO this is resource waste when we 
> calc. map tile each time when we want check terrain, special, city, 
> etc, many time in one fuction call.
> 
> I attach some fix code but this don't tuch all cases and someone could 
> check it becouse large part of it I made yesterday late night ( or 
> early morning :) and something I may be corrupt.

While in general the changes look like a good idea some numbers would
be nice. How much speed gain do you get?

Also I don't like is_ocean (I haven't noticed this before your
patch). While the comment
   
/* These gets used very commonly, but we might change the definition of
 * ocean at a later date, and then we'll need to change only these
 * defines. */

suggests good things IMHO it doesn't do good. The reason is that both
is_ocean and "terrain == T_OCEAN" are used for different things. And a
splitting of T_OCEAN will change how these things are controlled. The
list includes:
 - possiblity to build naval units
 - possiblity to build offshore
 - possiblity to build harbour
 - possiblity to found a new city
 - possiblity to attack from terrain1 to terrain2
 - test if a land unit is transported on water (kludge)
 - possiblity that a trireme sinks
 - possiblity to irritating a tile
 - ....

So any change here (splitting T_OCEAN into T_OCEAN and T_SHORE for
example) will change these sematics outlined above. Merging them now
in is_ocean doesn't buy as anything. Better would be to have
is_naval_units_ocean and so on. However even better would be to
specify this from the ruleset. So a Wet (or WaterForIrritation) flag
is needed in the terrain ruleset.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  A supercomputer is a computer running an endless loop in just a second




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