Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: [UPDATE] Corecleanup_08 patch to cvs-Sep28
Home

[Freeciv-Dev] Re: [UPDATE] Corecleanup_08 patch to cvs-Sep28

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [UPDATE] Corecleanup_08 patch to cvs-Sep28
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 3 Oct 2001 11:00:38 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Tue, Oct 02, 2001 at 09:58:01PM -0400, Ross W. Wetmore wrote:
> At 09:28 AM 01/10/02 +0200, Raimar Falke wrote:
> >On Mon, Oct 01, 2001 at 08:04:17PM -0400, Ross W. Wetmore wrote:
> >Can you make a proposal (list what has to be changed, how it is
> >controlled, performance impact,...) of the generalization of the map
> >topology? So that we can have the four types (flat, like now,
> >donut,...). This is the next big step IMHO.
> 
> I suspect getting up to snuff with the corecleanups is still a prereq
> since you have a lot of bugfixes and updates to work through yet.
> 
> However, when you are clean, these are the changes - pretty miniscule
> right?.
> 
> Cheers,
> RossW
> =====
> 
> See map.h for more details:
>  *
>  * For toroidal maps (aka donut worlds), is_real_tile and normalize_map_pos
>  *   always return TRUE. normalize_map_pos and _map_adjust_* always adjust
>  *   both x and y.
>  * For flat-earth, is_real_tile checks both x and y within bounds, and
>  *   normalize_map_pos and map_adjust_* are just bounds checks.
>  *
>    
> 
> These two functions control most of the topology effects, both where used
> explictly and in the iterate loops (map_adjust is effectively gone).
> 
> There are a small number of places where one still does explicit map 
> wrap operations like the get_citymap_xy() example. You can grep for 
> has_mapwrap() to locate them. They are in city.c, gotohand.c and mapgen.c
> (and of course map.c and map.h where the macro and function definitions 
> are).
> 
> 
> #define is_real_tile(X,Y)
>   \
> ( (has_mapwrap(MAP_TYPE_WRAPX) || RANGE_CHECK_0(map.xsize, (X))) &&
>   \
>   (has_mapwrap(MAP_TYPE_WRAPY) || RANGE_CHECK_0(map.ysize, (Y))) )
> 
> This is the typical magnitude of the change. 

> It does not show up on profiling even when using the functional form
> of either of the two controlling operations.

is_real_tile isn't used much anymore. normalize_map_pos is used most
of the time and may became more expensive.

> /* Map topology definitions and map dimension related macros                */
> /* The default definition reflects a cylindrical map wrapping at map.xsize  */
> 
> enum MAP_TYPE {
>   MAP_TYPE_FLAT  = 0,  /* Note: not a WRAPTYPE */
>   MAP_TYPE_WRAPX = 1,
>   MAP_TYPE_WRAPY = 2,
>   MAP_TYPE_TORUS = 3
> };
> extern enum MAP_TYPE map_type;
> 
> #ifdef FC__MAP_C            /* allocated in common/map.c */
> /* TODO: provide a settable and savable civ_map parameter, and
>  *       chenge map_type to a macro pointing at this location.
>  *       e.g. #define map_type civmap->maptype
>  * Note:
>  * If one defines map_type to a constant, most compilers remove all
>  * resolvable checks in macros that use this. For example, #defining
>  * map_type to MAP_TYPE_WRAPX, will reduce to the standard hardcoded
>  * cylindrical world.
> */
> enum MAP_TYPE map_type = MAP_TYPE_WRAPX;
> #endif
> 
> /*
>  * These two macros allow one to determine the current game map topology.
>  * They are primarily used in the key map coordinate macros, but are used
>  * in scattered code that needs to knwo this information.
>  *
>  * The argument to is_maptype is one of the enum MAP_TYPES.
>  * The argument to has_wraptype is one of the non-zero enum MAP_TYPES.
>  */
> #define is_maptype(TYPE)        (map_type == (TYPE))
> #define has_mapwrap(WRAPTYPE)   ((map_type & (WRAPTYPE)) == (WRAPTYPE))
>  

> stdinhand.c:
>   { "maptype", (int *)&map_type, NULL, NULL,
>     SSET_MAP_GEN, SSET_TO_CLIENT,
>     MAP_TYPE_FLAT, MAP_TYPE_TORUS, MAP_TYPE_WRAPX,
>     N_("Map type or topology"), "" },

Can this be made a non-numeric argument?

What about map generation? What about isometric maps? What about
savegames?

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "At the beginning of the week, we sealed ten BSD programmers
  into a computer room with a single distribution of BSD Unix.
  Upon opening the room after seven days, we found all ten programmers 
  dead, clutching each other's throats, and thirteen new flavors of BSD."


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