[Freeciv-Dev] (PR#11022) SEGFAULT: citymap_is_reserved (ptile=0x0)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=11022 >
I have no idea how this code works. But this patch should avoid the
crash. Feel free to fill in the FIXME comment with useful explanation.
jason
Index: server/settlers.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.209
diff -u -r1.209 settlers.c
--- server/settlers.c 1 Oct 2004 17:53:02 -0000 1.209
+++ server/settlers.c 15 Nov 2004 18:10:54 -0000
@@ -1142,8 +1142,12 @@
}
/* Go make a city! */
ai_unit_new_role(punit, AIUNIT_BUILD_CITY, result.tile);
- /* Reserve best other tile */
- citymap_reserve_tile(result.other_tile, punit->id);
+ if (result.other_tile) {
+ /* Reserve best other tile (if there is one). */
+ /* FIXME: what is an "other tile" and why would we want to reserve
+ * it? */
+ citymap_reserve_tile(result.other_tile, punit->id);
+ }
punit->goto_tile = result.tile; /* TMP */
} else if (best_impr > 0) {
UNIT_LOG(LOG_SETTLER, punit, "improves terrain instead of founding");
|
|