Complete.Org:
Mailing Lists:
Archives:
freeciv-dev:
November 2003: [Freeciv-Dev] (PR#6721) First real code of Quincuncial Topo AddOn see th |
[Freeciv-Dev] (PR#6721) First real code of Quincuncial Topo AddOn see th[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
--- common/map.h.orig 2003-11-01 14:58:10.000000000 +0100 +++ common/map.h 2003-11-01 14:57:27.000000000 +0100 @@ -187,9 +187,18 @@ /* Bit-values. */ TF_WRAPX = 1, TF_WRAPY = 2, - TF_ISO = 4 + TF_QUINCUNCIAL=4, + TF_ISO = 8 }; +/* +if TF_QUINCUNCIAL and no wrap there is a QUINCUNCIAL_SQ TOPO (no first TODO) +if TF_QUINCUNCIAL and TF_WRAPX there is a QUINCUNCIAL normal as is in doc/HACKING (first one TODO ) +if TF_QUINCUNCIAL and TF_WRAPY there is a QUINCUNCIAL but verticaly ( no first TODO) +if TF_WRAPY, TF_WRAPX and TF_QUINCUNCIAL are set this is error and we unset all +Begin implementing the (TF_QUINCUNCIAL & TF_WRAPX) (mburda@xxxxxxxxx) +*/ + #define CURRENT_TOPOLOGY (map.topology_id) #define topo_has_flag(flag) ((CURRENT_TOPOLOGY & (flag)) != 0) @@ -227,7 +236,10 @@ #define CHECK_MAP_POS(x,y) ((void)0) #define CHECK_INDEX(index) ((void)0) #endif - +/****************************************************************************** +* this one is no more right, there is not posible to adjust y, without x +* and vice versa, i go change it soon (mburda) +******************************************************************************/ #define map_adjust_x(X) \ ((X) < 0 \ ? ((X) % map.xsize != 0 ? (X) % map.xsize + map.xsize : 0) \ @@ -238,6 +250,65 @@ #define map_adjust_y(Y) \ (((Y)<0) ? 0 : (((Y)>=map.ysize) ? map.ysize-1 : (Y))) +/* there is the new way for adjust_x and adjust_y, see doc/HACKING */ +/* rotated if tile need to get 180° rotation */ +/* no city if singularity(x,y) is TRUE ! */ + + +/* Good version of % operator : */ +#define MODULO(X,M) ((X)%(M)>=0?(X)%(M):(M)+(X)%(M)) +/* nice operator for FLAT and CYLINDRICAL */ +#define LIMIT(X,L) (((X)<0) ? 0 : (((X)>=(L)) ? (L)-1 : (X))) + +#define map_flat_rotated(X, Y) FALSE +#define map_flat_singularity(X, Y) FALSE +#define map_flat_adjust_x(X,Y) LIMIT((X),map.xsize) +#define map_flat_adjust_y(X,Y) LIMIT((Y),map.ysize) + + +#define map_wrapx_only_rotated(X, Y) FALSE +#define map_wrapx_only_singularity(X, Y) FALSE +#define map_wrapx_only_adjust_x(X,Y) MODULO((X),map.xsize) +#define map_warpx_only_adjust_y(X,Y) LIMIT((Y),map.ysize) + +#define map_wrapy_only_rotated(X, Y) FALSE +#define map_wrapy_only_singularity(X, Y) FALSE +#define map_wrapy_only_adjust_x(X,Y) LIMIT((X),map.xsize) +#define map_warpy_only_adjust_y(X,Y) MODULO((Y),map.ysize) + +#define map_wrapxy_rotated(X, Y) FALSE +#define map_wrapxy_singularity(X, Y) FALSE +#define map_wrapxy_adjust_x(X,Y) MODULO((X),map.xsize) +#define map_warpxy_adjust_y(X,Y) MODULO((Y),map.ysize) + + + +#define map_quincuncial_wrapx_rotated(X, Y) (MODULO((Y),2*map.ysize)>=map.ysize) +#define map_quincuncial_wrapx_singularity(X, Y) \ + (\ + (MODULO((Y), map.ysize) < 2 || MODULO((Y), map.ysize) >= map.ysize -2) \ + && \ + (MODULO((X), map.xsize/2) < 2 || MODULO((X), map.xqize/2) >= map.xsize/2-2)\ + ) +#define map_quincuncial_wrapx_adjust_x(X,Y) \ + (\ + MODULO((Y),2*map.ysize) < map.ysize\ + ? MODULO((X), map.xsize)\ + : MODULO(map.xsize-(X)-1, map.xsize)\ + ) +#define map_quincuncial_wrapx_adjust_y(X,Y)\ + (\ + MODULO((Y), 2*map.ysize) < map.ysize\ + ? MODULO((Y), 2*map.ysize)\ + : (2*map.ysize)-1-MODULO((Y),2*map.ysize)\ + ) + +/* TODO QUINCUNCIAL_wrapy (very easy ;-) as wrapx ) + QUINCUNCIAL_no_wrap (very dificult :-0, realy!) */ + +/************************************************************************** +END QUINCUNCIAL ADDON mburda@xxxxxxxxx +***************************************************************************/ /* Obscure math. See explanation in doc/HACKING. */ #define native_to_map_pos(pmap_x, pmap_y, nat_x, nat_y) \ (topo_has_flag(TF_ISO) \ Hello This code only add some macros but there are very important ones for all developpers of freeciv, this topology need to rotate tiles and undestand some spetials point in the map. Read it before more change in the code are maked. The docs and maps samples are send under number 6719 ans 6720 (sorry 2 times the some) thx map.h are the only file modifiedHello This code only add some macros but there are very important ones for all developpers of freeciv, this topology need to rotate tiles and undestand some spetials point in the map. Read it before more change in the code are maked. The docs and maps samples are send under number 6719 ans 6720 (sorry 2 times the some) thx map.h are the only file modified --- common/map.h.orig 2003-11-01 14:58:10.000000000 +0100 +++ common/map.h 2003-11-01 14:57:27.000000000 +0100 @@ -187,9 +187,18 @@ /* Bit-values. */ TF_WRAPX = 1, TF_WRAPY = 2, - TF_ISO = 4 + TF_QUINCUNCIAL=4, + TF_ISO = 8 }; +/* +if TF_QUINCUNCIAL and no wrap there is a QUINCUNCIAL_SQ TOPO (no first TODO) +if TF_QUINCUNCIAL and TF_WRAPX there is a QUINCUNCIAL normal as is in doc/HACKING (first one TODO ) +if TF_QUINCUNCIAL and TF_WRAPY there is a QUINCUNCIAL but verticaly ( no first TODO) +if TF_WRAPY, TF_WRAPX and TF_QUINCUNCIAL are set this is error and we unset all +Begin implementing the (TF_QUINCUNCIAL & TF_WRAPX) (mburda@xxxxxxxxx) +*/ + #define CURRENT_TOPOLOGY (map.topology_id) #define topo_has_flag(flag) ((CURRENT_TOPOLOGY & (flag)) != 0) @@ -227,7 +236,10 @@ #define CHECK_MAP_POS(x,y) ((void)0) #define CHECK_INDEX(index) ((void)0) #endif - +/****************************************************************************** +* this one is no more right, there is not posible to adjust y, without x +* and vice versa, i go change it soon (mburda) +******************************************************************************/ #define map_adjust_x(X) \ ((X) < 0 \ ? ((X) % map.xsize != 0 ? (X) % map.xsize + map.xsize : 0) \ @@ -238,6 +250,65 @@ #define map_adjust_y(Y) \ (((Y)<0) ? 0 : (((Y)>=map.ysize) ? map.ysize-1 : (Y))) +/* there is the new way for adjust_x and adjust_y, see doc/HACKING */ +/* rotated if tile need to get 180° rotation */ +/* no city if singularity(x,y) is TRUE ! */ + + +/* Good version of % operator : */ +#define MODULO(X,M) ((X)%(M)>=0?(X)%(M):(M)+(X)%(M)) +/* nice operator for FLAT and CYLINDRICAL */ +#define LIMIT(X,L) (((X)<0) ? 0 : (((X)>=(L)) ? (L)-1 : (X))) + +#define map_flat_rotated(X, Y) FALSE +#define map_flat_singularity(X, Y) FALSE +#define map_flat_adjust_x(X,Y) LIMIT((X),map.xsize) +#define map_flat_adjust_y(X,Y) LIMIT((Y),map.ysize) + + +#define map_wrapx_only_rotated(X, Y) FALSE +#define map_wrapx_only_singularity(X, Y) FALSE +#define map_wrapx_only_adjust_x(X,Y) MODULO((X),map.xsize) +#define map_warpx_only_adjust_y(X,Y) LIMIT((Y),map.ysize) + +#define map_wrapy_only_rotated(X, Y) FALSE +#define map_wrapy_only_singularity(X, Y) FALSE +#define map_wrapy_only_adjust_x(X,Y) LIMIT((X),map.xsize) +#define map_warpy_only_adjust_y(X,Y) MODULO((Y),map.ysize) + +#define map_wrapxy_rotated(X, Y) FALSE +#define map_wrapxy_singularity(X, Y) FALSE +#define map_wrapxy_adjust_x(X,Y) MODULO((X),map.xsize) +#define map_warpxy_adjust_y(X,Y) MODULO((Y),map.ysize) + + + +#define map_quincuncial_wrapx_rotated(X, Y) (MODULO((Y),2*map.ysize)>=map.ysize) +#define map_quincuncial_wrapx_singularity(X, Y) \ + (\ + (MODULO((Y), map.ysize) < 2 || MODULO((Y), map.ysize) >= map.ysize -2) \ + && \ + (MODULO((X), map.xsize/2) < 2 || MODULO((X), map.xqize/2) >= map.xsize/2-2)\ + ) +#define map_quincuncial_wrapx_adjust_x(X,Y) \ + (\ + MODULO((Y),2*map.ysize) < map.ysize\ + ? MODULO((X), map.xsize)\ + : MODULO(map.xsize-(X)-1, map.xsize)\ + ) +#define map_quincuncial_wrapx_adjust_y(X,Y)\ + (\ + MODULO((Y), 2*map.ysize) < map.ysize\ + ? MODULO((Y), 2*map.ysize)\ + : (2*map.ysize)-1-MODULO((Y),2*map.ysize)\ + ) + +/* TODO QUINCUNCIAL_wrapy (very easy ;-) as wrapx ) + QUINCUNCIAL_no_wrap (very dificult :-0, realy!) */ + +/************************************************************************** +END QUINCUNCIAL ADDON mburda@xxxxxxxxx +***************************************************************************/ /* Obscure math. See explanation in doc/HACKING. */ #define native_to_map_pos(pmap_x, pmap_y, nat_x, nat_y) \ (topo_has_flag(TF_ISO) \
|