[Freeciv-Dev] (PR#9488) avoid a hex-related assertion in get_grid_color
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#9488) avoid a hex-related assertion in get_grid_color |
From: |
"Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> |
Date: |
Fri, 23 Jul 2004 08:25:56 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9488 >
If you use a "bad" tileset with a hex map, an assertion in
get_grid_color will trigger because tiles that are adjacent on the
tileset aren't actually adjacent on the map.
This is easily fixed.
(Perhaps we'd want to proceed with the standard choosing of the grid
color as if the tiles were adjacent? But instead I chose to treat the
direction as invalid and to draw a default line there.)
jason
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.135
diff -u -r1.135 mapview_common.c
--- client/mapview_common.c 25 Jun 2004 16:38:48 -0000 1.135
+++ client/mapview_common.c 23 Jul 2004 15:24:47 -0000
@@ -94,10 +94,11 @@
assert(is_real_map_pos(x1, y1));
- if (is_real_map_pos(x2, y2)) {
- normalize_map_pos(&x2, &y2);
- assert(is_tiles_adjacent(x1, y1, x2, y2));
-
+ /* If the second position isn't real or is not adjacent to the first
+ * position (this is possible with hex topologies) use a fallback
+ * value. */
+ if (normalize_map_pos(&x2, &y2)
+ && is_tiles_adjacent(x1, y1, x2, y2)) {
if (map_get_tile(x2, y2)->known == TILE_UNKNOWN) {
return COLOR_STD_BLACK;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#9488) avoid a hex-related assertion in get_grid_color,
Jason Short <=
|
|