[Freeciv-Dev] Re: Map coordinate cleanups.
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Raimar Falke writes:
> 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.
ffs is not portable. It does not exist on mingw targets and on amigaos.
(without using ixemul.library (unix emulation like cygwin.dll on
windows))
Or should we put a my_ffs into common/support.c?
Greetings
Andreas Kemnade
- [Freeciv-Dev] Re: Map coordinate cleanups., (continued)
- [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, 2001/08/16
- [Freeciv-Dev] Re: Map coordinate cleanups.,
Andreas Kemnade <=
- [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
|
|