Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2004:
[Freeciv-Dev] Re: (PR#7555) Wrong assert in packhand.c:handle_city_info
Home

[Freeciv-Dev] Re: (PR#7555) Wrong assert in packhand.c:handle_city_info

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: remi.bonnet@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7555) Wrong assert in packhand.c:handle_city_info
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 27 Feb 2004 08:15:56 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7555 >

Remi Bonnet wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7555 >
> 
> assert(can_player_see_units_in_city());
> 
> This assert can be triggered when a diplomat investigate the city.

So it can.  I'd argue this is because diplomat-investigating-city is 
done wrongly; but obviously that's going to take longer to fix :-).

In the meantime I *think* this patch should make things work.  Please test.

jason

Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.353
diff -u -r1.353 packhand.c
--- client/packhand.c   2004/02/23 05:31:19     1.353
+++ client/packhand.c   2004/02/27 16:15:05
@@ -510,11 +510,14 @@
                                    &need_effect_update);
   } impr_type_iterate_end;
 
-  /* Since we can see inside the city, just determine the client status
-   * from what we know. */
-  assert(can_player_see_units_in_city(game.player_ptr, pcity));
-  pcity->client.occupied =
-      (unit_list_size(&(map_get_tile(pcity->x, pcity->y)->units)) > 0);
+  /* We should be able to see units in the city.  But for a diplomat
+   * investigating an enemy city we can't.  In that case we don't update
+   * the occupied flag at all: it's already been set earlier and we'll
+   * get an update if it changes. */
+  if (can_player_see_units_in_city(game.player_ptr, pcity)) {
+    pcity->client.occupied
+      = (unit_list_size(&(map_get_tile(pcity->x, pcity->y)->units)) > 0);
+  }
 
   pcity->client.happy = city_happy(pcity);
   pcity->client.unhappy = city_unhappy(pcity);

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