[Freeciv-Dev] Re: Map coordinate cleanups.
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Thu, 16 Aug 2001, hawk@xxxxxxxxxxxxxxxxxxxxxxx wrote:
>> >> +/* FIXME: These are particularly useless, but used everywhere.
>> >> +*/
>> >
>> > 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. Moreover, if
>> you use the array look-up method the reader will know without any
>> further ado that there is checking on arguments etc. (one of the
>> things I really 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.)
>
> The abstraction is about knowning the underlying global variable or
> not. If all access to this variable is through methods or macros the
> variable can be removed from the global scope. I consider this a
> good thing.
So you've removed the variable from the global scope and put a
function there instead. To me, that sounds mostly like "a step
forward and then a step backward". But it's not a big deal.
> Besides this I also dislike the mixed use of ids and pointers. There
> is no way to get from the name of the method the types of the
> arguments. I like get_tile_type() because it is a clear
> id-to-pointer method. There should be such a method for every object
> with a consisting name. Currently there is find_unit_by_id(),
> get_tile_type(), find_city_by_id(), get_government() and so on. Also
> each struct should have a field "id" and not something like
> "player_no". I would like to get the opinions of others to the
> id-vs-pointer topic.
I couldn't agree more. I think it would be a good thing if one of the
two went away; I don't care much which.
>> in a clean source tree. Direct access to tile_types outnumber
>> get_tile_type() calls by two to one.
>
> Yes the current situation is inconsistent. However the question is:
> which construct is the goal?
I don't care at all that much. However, I think the current "neither
here nor there" situation is worse than either alternative.
--
Big Gaute http://www.srcf.ucam.org/~gs234/
Awright, which one of you hid my PENIS ENVY?
- [Freeciv-Dev] Re: Map coordinate cleanups., (continued)
- [Freeciv-Dev] Re: Map coordinate cleanups., Andreas Kemnade, 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., 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, 2001/08/16
[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
|
|