Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#10047) RFC: restructuring map code to not use cartesia
Home

[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]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10047) RFC: restructuring map code to not use cartesian coordinates
From: "Jason Short via RT" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 25 Sep 2004 22:49:00 -0700
Reply-to: RT_CorrespondAddressNotSet@xxxxxxxxxxxxxx

<URL: http://RT::WebBaseURL.not.configured:80/Ticket/Display.html?id=10047 >

Here is a new version of the patch.  I fixed a bug in my changes to
iterate_axe.  Autogames are now identical.

When running in DEBUG, this makes the server run 5-15% faster.  When
running NDEBUG, this drops to 0-5% faster.  These numbers are slightly
better for isometric maps.

There is a cost of 80k of memory for the extra 20 bytes per tile to
store (index,map_x,map_y,nat_x,nat_y) values for each tile.  Of course
we don't really *have* to store any of these.  The index can be
determined by the pointer value and the others can be found from the
index.  It is a tradeoff of speed and convenience versus memory.

However speed isn't the real advantage of the new system.  The advantage
is the code is shorter and simpler and safer.  It becomes obvious where
normalizations and CHECK_MAP_POS checks are needed.  It is possible to
have a "no-tile" special-case without resorting to hackery.  And the
whole thing is typesafe so there's no chance of confusing your x's and
y's with your i's and j's.

I'm still not sure what to do with it, though.

jason



[Prev in Thread] Current Thread [Next in Thread]