[Freeciv-Dev] Re: [Patch] Map coord. to city map transformation and bac
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
At 10:16 AM 01/09/26 +0200, Raimar Falke wrote:
>On Wed, Sep 26, 2001 at 12:17:52AM -0400, Ross W. Wetmore wrote:
>> /**************************************************************************
>> ...
>> **************************************************************************/
>> int is_valid_city_coords(const int city_x, const int city_y)
>> {
>> if ((city_x == 0 || city_x == CITY_MAP_SIZE-1)
>> && (city_y == 0 || city_y == CITY_MAP_SIZE-1))
>> return 0;
>> if ( !RANGE_CHECK_0(CITY_MAP_SIZE, city_x)
>> || !RANGE_CHECK_0(CITY_MAP_SIZE, city_y) )
>> return 0;
>>
>> return 1;
>> }
>
>Can you make a patch with RANGE_CHECK and RANGE_CHECK_0 and the
>changes to is_valid_city_coords?
The AI cleanups are stable now, smallpox behaviour is controlled and
the AI moves on to more advanced forms of government and growth without
too much chaotic behaviour. It even defends itself without relying on
hordes of military cannon fodder to screen its cities from direct attack.
I particularly like the fact that wounded units go to the nearest
friendly hospital to heal instead of limping off after the next chance
to suicide against something. It is still pretty easily distracted into
a war, but the Civs will go for Alpha Centauri without the xenophobic
need to first eliminate all known forms of game life.
But there are a couple minor things I want to look at before the next
drop of the corecleanup drop. I'm shooting for this weekend.
Since you plan to rewrite all patches yourself, it shouldn't be too much
trouble to extract what you need from the drop instead for these little
bits. Just unpack a fully patched version off to the side and grep through
for the things you want to move over. It probably isn't worth my time to
prepare and test pretty patches that don't get used, at least not until
the system rules get clarified and followed consistently, or Freeciv
development moves from the despotic to a higher form of government itself
:-).
The other aspect is that the patches needed to make resyncing useful
are big, or there are simply too many little ones if it is going to
take week's of wrangling and petty adjustments to get each in. When
you have digested enough of the rationale and background to be more
comfortable with what is in the corecleanups, I will help put together
what is needed to move significant chunks of it in in a tested clean
way. In the meantime you have the drops to look over and cull for
smaller bits that are immediately useful.
As you said, I should consider my version to be where things are going
and just run it in tandem a while longer.
>> /**************************************************************************
>> Given a real map position and a city, finds the city map coordinates of the
>> tiles.
>> Returns TRUE (== 1) if the real map position was inside the city map.
>> **************************************************************************/
>> int get_citymap_xy(const struct city *pcity, const int x, const int y,
>> int *city_x, int *city_y)
>> {
>> /* Get x,y relative to the NW corner of pcity */
>> *city_x= (x - pcity->x + CITY_MAP_SIZE/2);
>> *city_y= (y - pcity->y + CITY_MAP_SIZE/2);
>>
>> /* If coords can wrap, we can be off by +/- xsize,ysize. */
>> if( has_mapwrap(MAP_TYPE_WRAPX) )
>> *city_x= map_wrap_x(*city_x);
>
>Your map_wrap_x method does really work with city coordinates
>(0,...,4)?
The wrapping factor is the map.xsize (or map.ysize when you reach that
level). Use the standard one.
Note that the adjustment to the NW corner, i.e. x - (pcity->x - CITY..)
means that the citymap origin is now at 0,0 and you compute the delta
from this. The wrap adjustment may move a value at -1 to map.xsize-1
in this coordinate system but this is rejected by the is_valid test in
either case.
Only the first CITY_MAP_SIZE values in either coordinate will lie in
the citymap locality and can test true. All delta offsets will be +ve
after wrapping.
Another way to think about it is that there really is no hard wrapwall
in a wrapped world. This is something imposed on the map to reflect
external tile storage boundaries or the need to choose some line like the
Greenwich meridian to start counting from. In the case of determining
citymap coordinates it is useful to define the 0'th meridian to coincide
with the citymap origin.
>> These should be replaced by get_citymap_xy, just as map_adjust_* are
>> replaced by normalize_map_pos.
>
>Full ack.
>
> Raimar
>
>--
> email: rf13@xxxxxxxxxxxxxxxxx
> "Reality? That's where the pizza delivery guy comes from!"
Cheers,
RossW
|
|