Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: [PATCH] more small directional cleanups
Home

[Freeciv-Dev] Re: [PATCH] more small directional cleanups

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] more small directional cleanups
From: Jason Dorje Short <jshort@xxxxxxxxxxxxx>
Date: Wed, 22 Aug 2001 04:24:33 -0400

Raimar Falke wrote:
> 
> On Tue, Aug 21, 2001 at 11:40:17PM -0400, Jason Dorje Short wrote:

> > Better because it's in the "default" case or better because it returns
> > "Bad Direction"?  The second is good, the first one I find less legible.
> 
> You have programmed the same as a default case but didn't put it into
> the switch statement where a programmer will expect it.

For me, it's more legible at the end...it's easier for me to see the
flow of the program.

> > +  int dirs[8] = {0, 1, 2, 3, 4, 5, 6, 7}; /* list of all 8 directions */
> 
> You introduce new magic numbers?

They're not magic; all they assume about the directional system is that
the directions go 0-7 (which is also implied by DIR_DX/DIR_DY arrays). 
The order is irrelevant since they're just used for the random lookup.

Both are fine either way IMO.  Thanks for applying it :-)

jason


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