Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: Map coordinate cleanups.
Home

[Freeciv-Dev] Re: Map coordinate cleanups.

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gaute B Strokkenes <gs234@xxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Map coordinate cleanups.
From: Trent Piepho <xyzzy@xxxxxxxxxxxxx>
Date: Thu, 16 Aug 2001 15:06:09 -0700 (PDT)

On Thu, 16 Aug 2001, Gaute B Strokkenes wrote:
> > 
> > Maybe it is time to decide which rule freeciv should follow. I would
> > vote for the extra {}s.
> 
> I vote against, obviously.  But I don't feel very strongly about it.
> I suspect that there is already a rule for this: the style guide
> mandates K&R style, so someone who cares can go and look it up and
> then tell the rest of us what it is.

Back when we came up with the style guidlines, the main idea was to be
consistant with that was written already.  Lots of code doesn't use the extra
braces, so that should be considered ok.

> They don't.  get_tile_type() takes a terrain identifies and returns a
> struct describing that terrain, without any error checking.  An array
> look-up is a perfectly acceptable, commonplace idiom to go from a FOO
> identifier to FOO_TYPE descriptor struct.  Moreover, if you use the

The thing is, that might no always be the case.  What if something is changed
from an array to a linked-list or a hash table?  Then an array lookup won't
work.  It's better to plan ahead than to do something you know is going to
need to be fixed in the future.

> dislike about Freeciv is the way that there seems to be no rhyme or
> reason to which of the map_get_* and associated functions check and/or
> repair their arguements.)

There isn't supposed to be any checing or repair.  The functions that do have
it are because it was a kludge fix to code that wasn't checking when it called
them.

> 
> in a clean source tree.  Direct access to tile_types outnumber
> get_tile_type() calls by two to one.

That's because get_tile_type was created later.  All the existing code should
have been changed to use it, but that didn't happen.



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