[Freeciv-Dev] Re: the directional system
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Sun, Sep 16, 2001 at 02:08:21PM +0200, Raimar Falke wrote:
> > > diff -urd -X freeciv.current/diff_ignore freeciv.current/common/map.h
> > > work/common/map.h
> > > --- freeciv.current/common/map.h Fri Sep 14 09:31:33 2001
> > > +++ work/common/map.h Fri Sep 14 18:47:39 2001
> > > @@ -442,7 +442,16 @@
> > > };
> > >
> > > /* return the reverse of the direction */
> > > -#define DIR_REVERSE(dir) (7 - (dir))
> > > +#define DIR_REVERSE(dir) \
> > > +((dir)==DIR8_WEST?DIR8_EAST: \
> > > + ((dir)==DIR8_EAST?DIR8_WEST: \
> > > + ((dir)==DIR8_NORTH?DIR8_SOUTH: \
> > > + ((dir)==DIR8_SOUTH?DIR8_NORTH: \
> > > + ((dir)==DIR8_NORTHWEST?DIR8_SOUTHEAST: \
> > > + ((dir)==DIR8_NORTHEAST?DIR8_SOUTHWEST: \
> > > + ((dir)==DIR8_SOUTHWEST?DIR8_NORTHEAST: \
> > > + ((dir)==DIR8_SOUTHEAST?DIR8_NORTHWEST: \
> > > + (dir)/0))))))))
> > >
> > > /* is the direction "cardinal"? Cardinal directions
> > > * (also called cartesian) are the four main ones */
> >
> > This way you hardwire a 'chess-like' grid, which is less general than
> > a general rotational system. For example, the 3 other types of regular
> > Cartesian grids (triangular, square without diagonals, hexagonal)
>
> > cannot be expressed in this way
>
> Why not?
Triangular only has DIR1 to DIR3, square DIR1 to DIR4,
hexagonal DIR1 to DIR6.
> >, while they would be fairly easy to implement in Freeciv.
>
> I doubt this. There would be a lot of places which have to change.
Yes, but it can still be done with adjacent square tiles; for
triangular and hexagonal you have to shift the rows by half,
and for triangular you also have to leave holes:
+-+-+-+-+-+-+-+-+-+-+-+-+
| |XXX| | |XXX| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | |XXX| | |XXX|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |XXX| | |XXX| |
+-+-+-+-+-+-+-+-+-+-+-+-+
The correspondence between adjacency on the map and adjacency in the
array is no longer direct, but the interface would hardly change.
> > > So the general form is 1% slower.
> > >
> > > Raimar
> >
> > That's acceptable, and as long as no other grid types are supported,
> > it's obvious makes the code easier to understand.
>
> I wasn't proposing such a change. We are still in a performance
> discussion ;)
OK, sorry I misunderstood.
> 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: the directional system, (continued)
- [Freeciv-Dev] Re: the directional system, Greg Wooledge, 2001/09/07
- [Freeciv-Dev] Re: the directional system, Ross W. Wetmore, 2001/09/07
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/08
- [Freeciv-Dev] Re: the directional system, Gaute B Strokkenes, 2001/09/11
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/12
- [Freeciv-Dev] Re: the directional system, Gaute B Strokkenes, 2001/09/13
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/14
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/14
- [Freeciv-Dev] Re: the directional system, Reinier Post, 2001/09/16
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/16
- [Freeciv-Dev] Re: the directional system,
Reinier Post <=
[Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/07
[Freeciv-Dev] Re: the directional system, Ross W. Wetmore, 2001/09/07
|
|