[Freeciv-Dev] Re: topology RFC (again)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
At 10:27 AM 01/10/30 +0100, Raimar Falke wrote:
>On Mon, Oct 29, 2001 at 10:43:28PM -0500, Ross W. Wetmore wrote:
>> At 10:35 AM 01/10/29 +0100, Raimar Falke wrote:
>> >On Sun, Oct 28, 2001 at 03:10:58PM -0400, Ross W. Wetmore wrote:
>> >> There may be corresponding functions which do take GUI or citymap
>> >> coordinates
>> >
>> >There will no special citymap functions. All citymap can and should be
>> >transformed to map positions.
>>
>> Raimar, citymap coordinates run from [0:CITY_MAP_SIZE-1][0:CITY_MAP_SIZE-1]
>> and lots of code uses these.
>
>My fault I meant: there will be no
Divine pronouncements from a position of ignorance are not generally
of much value :-).
>is_real_city_map_position(pcity,x,y) and no
>normalize_city_map_position(pcity,x,y),... Only the transformation
>methods and a test method of valid citymap position is needed.
There is actually a useful point or two for you to learn here if you
can pick up the underlying concepts.
is_valid_city_coords() which is your test method *is* the citymap
is_real_city_map_position() function. It tells you if the coordinates
are real or unreal, i.e. outside the bounds of the city.
Normalize_citymap_pos would not actually do anything except check the
citymap realness. If you read the docs in map.h corecleanups, you
will find this explained in terms of "flat-earth". If you can't wrap
or do any other "normalizing" operation, coordinates are either
"normal" or "unreal".
So the transformation, which returns a citymap is_real check status
actually combines transform and normalize operations. No other
functions are needed.
Now ...
Realness in game coordinates, which is the realnes you are probably
confusing with citymap realness, can only properly be checked in
game coordinates, or coordinates fixed with normalize_map_pos().
So what you say about first transforming and then checking realness
is exactly what you need to do if you are asking the question is it
a real game/map coordinate. If you understand this, you have the hard
justification for your instinctual reaction.
It is very useful in unwinding some of the existing practices to
ask the question, what coordinate space am I working in. What kind
of operation am I doing, translate, transform, normalize, reality
check, and what are the characteristics of that operation in the
given coordinate space. Game coordinates usually wrap, citymap
and gui coordinates describe flat-earth objects.
If you find yourself needing to do an operation that is defined in
another space, then you need to think about how to transform into
that space, before you do the operation, and maybe get back.
If you start confusing the operations and the spaces they operate
on, then there will be all kinds of problems, both conceptually
and in the code.
> Raimar
>--
> email: rf13@xxxxxxxxxxxxxxxxx
> A supercomputer is a computer running an endless loop in just a second
Cheers,
RossW
=====
- [Freeciv-Dev] Re: topology RFC (again), (continued)
- [Freeciv-Dev] Re: topology RFC (again), Ross W. Wetmore, 2001/10/29
- [Freeciv-Dev] Re: topology RFC (again), Jason Dorje Short, 2001/10/29
- [Freeciv-Dev] Re: topology RFC (again), Ross W. Wetmore, 2001/10/30
- [Freeciv-Dev] Re: topology RFC (again), Jason Dorje Short, 2001/10/30
- [Freeciv-Dev] Re: topology RFC (again), Ross W. Wetmore, 2001/10/30
- [Freeciv-Dev] Re: topology RFC (again), Jason Dorje Short, 2001/10/31
[Freeciv-Dev] Re: topology RFC (again), Jason Dorje Short, 2001/10/28
[Freeciv-Dev] Re: topology RFC (again), Raimar Falke, 2001/10/29
|
|