[Freeciv-Dev] (PR#7350) Map radius change with city size
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=7350 >
For iso-tileset, you use a citydlg width and height (in tiles) of
(city_map_width(pcity) - 1)
This works with the current setup becuse to fill a full square would
take city_map_width tiles; 1 tile is chopped off of each side saving a
half-tile width of display on each side.
But as the city map grows larger this will no longer work perfectly.
With a larger circle more than one tile may be lopped off. And with an
appropriately smaller circle less than one tile may be lopped off. For
instance if the citymap is
X X X
X X X
X X X
then radius == 1, width == 3, and the width of the citydlg must be 3
tiles in both iso and non-iso view.
Moreover I don't see a good way to predict this.
Therefore I suggest a workaround: figure it out at runtime! We can just
look at the positions of all the tiles, see what the maximum/minimum X
and Y values are, and determine the width/height from that. This in
turn is sufficient information for the city<->canvas conversion.
A disadvantage is we have to be sure to recalculate these values at the
proper times: when the tileset or topology changes. Another
disadvantage is it's harder to have the width and height change between
cities (although this is only one of many problems).
Attached is a demo patch. It's pretty straightforward. However it
extends map_to_gui_pos/gui_to_map_pos a bit past what its name indicates
it does. What we really want here are functions
cartesian_to_gui_pos/gui_to_cartesian_pos, which can be used for
map<->gui, city<->canvas, and vector<->canvas [1] conversions.
[1] See move_unit_map_canvas and draw_segment.
jason
recalculate.diff
Description: Binary data
- [Freeciv-Dev] Re: (PR#7350) Map radius change with city size, Raimar Falke, 2004/04/02
- [Freeciv-Dev] Re: (PR#7350) Map radius change with city size, Jason Short, 2004/04/04
- [Freeciv-Dev] Re: (PR#7350) Map radius change with city size, Raimar Falke, 2004/04/05
- [Freeciv-Dev] Re: (PR#7350) Map radius change with city size, Jason Short, 2004/04/05
- [Freeciv-Dev] (PR#7350) Map radius change with city size, Jason Short, 2004/04/09
- [Freeciv-Dev] (PR#7350) Map radius change with city size,
Jason Short <=
- [Freeciv-Dev] Re: (PR#7350) Map radius change with city size, rwetmore@xxxxxxxxxxxx, 2004/04/10
- [Freeciv-Dev] Re: (PR#7350) Map radius change with city size, Jason Short, 2004/04/11
- [Freeciv-Dev] (PR#7350) Map radius change with city size, Jason Short, 2004/04/16
- [Freeciv-Dev] Re: (PR#7350) Map radius change with city size, rwetmore@xxxxxxxxxxxx, 2004/04/17
- [Freeciv-Dev] Re: (PR#7350) Map radius change with city size, rwetmore@xxxxxxxxxxxx, 2004/04/17
- [Freeciv-Dev] Re: (PR#7350) Map radius change with city size, Jason Short, 2004/04/19
- [Freeciv-Dev] Re: (PR#7350) Map radius change with city size, Jason Short, 2004/04/20
|
|