[Freeciv-Dev] (PR#10047) RFC: restructuring map code to not use cartesia
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://RT::WebBaseURL.not.configured:80/Ticket/Display.html?id=10047 >
Here is an example patch of the indended design.
This is a rather mammoth patch; it took a lot more work than I expected.
However the results are even better than I expected. In particular it
makes bugs a lot harder because the conversion between unnormalized
"coordinate" values and normalized "tile" values is quite clear. This
simplifies things in the network code and the mapview code. Meanwhile
the mapgen code didn't provide any particular problems.
Only the gtk2 client is changed. The others shouldn't be too hard.
The main place to look at is the interface, in map.h. I'm considering
replacing normalize_map_pos() with a pair of functions:
map_pos_to_tile() and map_pos_to_tile_unchecked(). The first would be
the equivalent of normalize_map_pos + map_get_tile; the second would be
the equivalent of just map_get_tile (for insternal usage in iterator
macros).
I suspect the server is significantly faster under this patch. However
this is hard to verify because autogames are different. Most likely
this is because of reordered myrand() calls somewhere - I didn't pay any
attention to this when writing it. Less likely is that a bug in the
code is fixed. Even less likely is that a new bug is introduced...
There is however a good possibility a bug was introduced somewhere. It
would take the form of a straight-out crash at some point. This should
be easy to debug. Also I'm not sure about the agents code, which is
both very ugly and not typesafe...
Having written this, I'm not not sure what to do with it. It will not
be possible to keep it updated. Committing it at once is probably not a
good idea since in at least some places I was sloppy. So probably if we
can agree on a design the thing to do is still to work through the
changes one at a time.
jason
tiles.diff.bz2
Description: application/bzip
|
|