[Freeciv-Dev] Re: Map coordinate cleanups.
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Thu, Aug 16, 2001 at 02:15:07AM +0200, Gaute B Strokkenes wrote:
>
> + int x1 = pcity->x + x - 2;
> + int y1 = pcity->y + y - 2;
Can a function created which does this transformation? It is used all
over the place. This would be the reverse of
common/city.h:get_citymap_xy().
> - for (tt = T_FIRST; tt < T_COUNT; tt++) {
> - if (0 == strcmp (tile_types[tt].terrain_name, name)) {
> + for (tt = T_FIRST; tt < T_COUNT; tt++)
> + if (!strcmp (tile_types[tt].terrain_name, name))
> break;
> - }
> - }
> +
Maybe it is time to decide which rule freeciv should follow. I would
vote for the extra {}s.
> - for (inx = 0;
> - inx <
> sizeof(tile_special_type_names)/sizeof(tile_special_type_names[0]);
> - inx++) {
> - if (type & 0x1) {
> - return tile_special_type_names[inx];
> - }
> + for (i = 0; i < NUM_SPECIAL_NAMES; i++) {
> + if (type & 0x1)
> + return tile_special_type_names[i];
> +
> type >>= 1;
> }
Could this be rewritten to use ffs(3). There is no loop needed.
> +#if 1
> #define map_inx(x,y) \
> ((x)+(y)*map.xsize)
> +#endif
Mhh.
> +/* FIXME: These are particularly useless, but used everywhere. */
These methods provide abstraction.
> +#if 1
> +#define MAP(x,y) (map.tiles + (IS_PROP_TILE((x),(y)) \
> + ? ((x) + map.xsize * (y)) \
> + : (abort(), 0)))
> +#else
> +#define MAP(x,y) (map.tiles + (x) + map.xsize * (y))
> +#endif
Mhh.
> +#define MAPSTEP(x,y,x1,y1,dir) \
I like this one.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"Transported to a surreal landscape, a young girl kills the first woman
she meets and then teams up with three complete strangers to kill again."
-- TV listing for the Wizard of Oz in the Marin Independent Journal
- [Freeciv-Dev] Re: GTK client draws more slowly than it needs to, (continued)
- [Freeciv-Dev] Re: GTK client draws more slowly than it needs to, Raimar Falke, 2001/08/20
- [Freeciv-Dev] Re: Map coordinate cleanups., Kevin Brown, 2001/08/19
- [Freeciv-Dev] Re: Map coordinate cleanups., Ross W. Wetmore, 2001/08/19
- [Freeciv-Dev] Re: Map coordinate cleanups., Kevin Brown, 2001/08/19
- [Freeciv-Dev] Re: Map coordinate cleanups., Raimar Falke, 2001/08/20
- [Freeciv-Dev] Re: Map coordinate cleanups., Raimar Falke, 2001/08/16
- [Freeciv-Dev] Re: Map coordinate cleanups., Trent Piepho, 2001/08/16
- [Freeciv-Dev] Re: Map coordinate cleanups., Gaute B Strokkenes, 2001/08/16
- [Freeciv-Dev] Re: Map coordinate cleanups., Trent Piepho, 2001/08/16
- [Freeciv-Dev] Re: Map coordinate cleanups., Gaute B Strokkenes, 2001/08/17
[Freeciv-Dev] Re: Map coordinate cleanups.,
Raimar Falke <=
- [Freeciv-Dev] Re: Map coordinate cleanups., Andreas Kemnade, 2001/08/16
- [Freeciv-Dev] Re: Map coordinate cleanups., Raimar Falke, 2001/08/16
- [Freeciv-Dev] Re: Map coordinate cleanups., Marco Colombo, 2001/08/16
- [Freeciv-Dev] Re: Map coordinate cleanups., Raimar Falke, 2001/08/16
- [Freeciv-Dev] Re: Map coordinate cleanups., Marco Colombo, 2001/08/16
- [Freeciv-Dev] Re: Map coordinate cleanups., Raimar Falke, 2001/08/16
- [Freeciv-Dev] Re: Map coordinate cleanups., Kevin Brown, 2001/08/16
- [Freeciv-Dev] Re: Map coordinate cleanups., Marco Colombo, 2001/08/16
[Freeciv-Dev] Re: Map coordinate cleanups., Gaute B Strokkenes, 2001/08/16
|
|