Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2002:
[Freeciv-Dev] Client crash when t on land worked by hidden city (PR#1198
Home

[Freeciv-Dev] Client crash when t on land worked by hidden city (PR#1198

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Client crash when t on land worked by hidden city (PR#1198)
From: dspeyer@xxxxxxxxxxxxxxxxxxxxx
Date: Thu, 3 Jan 2002 19:21:51 -0800 (PST)

Full_Name: Daniel Speyer
Version: CVS Dec 23, 2001
Distribution: Built from source
Client: Gtk+
OS: GNU/Linux: Mandrake 8.0
Submission from: (NULL) (12.243.200.18)


If you use the 't' key on any tile which is being worked by an invisible (enemy)
city, the client will crash with a bad assertion:

civclient: mapview_common.c:296: find_city_near_tile: Assertion
`get_worker_city
(pcity, 5 - 1 - city_x, 5 - 1 - city_y) == C_TILE_EMPTY' failed.
Aborted


I think this patch should fix it:

--- freeciv-10-23/client/mapview_common.c       Sat Dec 22 02:06:08 2001
+++ freeciv/client/mapview_common.c     Thu Jan  3 20:59:39 2002
@@ -271,6 +271,7 @@
         "looked at".
     e.  If none of the cities were looked at last, choose "randomly".
     f.  If no cities can work it, return NULL.
+    g.  If an invisible (enemy) city is working it, return NULL
 **************************************************************************/
 struct city *find_city_near_tile(int x, int y)
 {
@@ -292,9 +293,11 @@
   city_map_checked_iterate(x, y, city_x, city_y, map_x, map_y) {
     pcity = map_get_city(map_x, map_y);
     if (pcity && pcity->owner == game.player_idx) {
+      /* rule g */
+      if (get_worker_city(pcity, CITY_MAP_SIZE - 1 - city_x,
+                            CITY_MAP_SIZE - 1 - city_y) != C_TILE_EMPTY)
+       return(NULL);
       /* rule c */
-      assert(get_worker_city(pcity, CITY_MAP_SIZE - 1 - city_x,
-                            CITY_MAP_SIZE - 1 - city_y) == C_TILE_EMPTY);
       if (pcity == last_pcity) {
        return pcity;           /* rule d */
       }




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