Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: [Patch] MAPSTEP
Home

[Freeciv-Dev] Re: [Patch] MAPSTEP

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Cc: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: [Patch] MAPSTEP
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 23 Sep 2001 16:10:22 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Sun, Sep 23, 2001 at 02:31:28PM +0100, Gregory Berkolaiko wrote:
>  --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> > On Sat, Sep 22, 2001 at 01:13:05PM +0100, Gregory Berkolaiko wrote:
> [...]
> > > However I strongly object to your use of _MAPSTEP because:
> > > 1. It obscures the code.
> > > 2. It is unnecessary.
> > > 3. It's got bad name (MAPSTEP_FROM_0 would be better if you insist on
> > > using it).
> > 
> > I introduced it for the case you mentioned below. You may have a way
> > to express this without an extra macro besides MAPSTEP.
> 
> Errr, actually my complaint was about you use of _MAPSTEP exactly in the
> case mentioned below.  Why do you want to get rid of DIR_D[XY] ?
> They've got good name, it's transperent what it does etc.
> I don't think you are making code any more readable/general by using this
> ugly _MAPSTEP.

The reason is that as the next step I plan to implement a 

#define GENERAL_DIR8_MAPSTEP(x,y,dir) \
((x=(dir==NORTHWEST||dir==WEST||dir==SOUTHWEST)?\
  -1:\
 (dir==NORTH||dir==SOUTH)?\
  0:\
 (dir==NORTHEAST||dir==EAST||dir==SOUTHEAST)?1:3/0),
same for y
)

#if USE_VERTICAL_DIRECTIONS
#define _MAPSTEP _MAPSTEP with DIR_DX
#endif

#if USE_OTHER_DIRECTION_SYSTEM
#define _MAPSTEP GENERAL_DIR8_MAPSTEP
#endif

So we can and should remove the DIR_DX array.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  "brand memory are for windows users that think their stability
   problems come from the memory"
    -- bomek in #freeciv



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