[Freeciv-Dev] Re: Map coordinate cleanups.
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Gaute B Strokkenes <gs234@xxxxxxxxx> wrote:
> > These methods provide abstraction.
>
> 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.
That's true...when you're dealing with an array.
But who says that we'll always be dealing with an array, instead of
something like a hash table, tree, or whatever? Using a function like
get_tile_type() lets you change the underlying implementation with
minimal consequences for the rest of the code.
So it *does* provide an abstraction, in that the caller doesn't need
to know how the tile types are stored.
So I happen to find functions a better approach overall for stuff like
this, at least when there are lots of places that make use of it.
--
Kevin Brown kevin@xxxxxxxxxxxxxx
It's really hard to define what "unexpected behavior" means when you're
talking about Windows.
- [Freeciv-Dev] Re: Map coordinate cleanups., (continued)
- [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
[Freeciv-Dev] Re: Map coordinate cleanups.,
Kevin Brown <=
[Freeciv-Dev] Re: Map coordinate cleanups., Trent Piepho, 2001/08/16
[Freeciv-Dev] Re: Map coordinate cleanups., Gregory Berkolaiko, 2001/08/16
Message not available
|
|