Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] (PR#7327) another occupied-city bug
Home

[Freeciv-Dev] (PR#7327) another occupied-city bug

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#7327) another occupied-city bug
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 26 Jan 2004 14:23:21 -0800
Reply-to: rt@xxxxxxxxxxx

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

When a unit in an enemy city dies the city's occupied flag is removed.

This type of bug crops up because the logic of when a player can see
into another city is not entirely clear.  Simply adding a macro/function
can_player_see_units_in_city() would be quite helpful.

Another thing that causes confusion is that currently
pcity->client.occupied is supposed to always have a valid value.  This
means when we _can_ see into the city (as in the case addressed by the
patch) we have to update it manually.  But this value is only checked in
one place: tilespec.c.  It would be easy to change this code in
tilespec.c to:

  bool is_city_occupied(pcity)
  {
    if (can_player_see_units_in_city(pcity)) {
      return (unit_list_size(...) > 0);
    } else {
      return pcity->client.occupied;
    }
  }

this would cut down the excessive logic in other places (like packhand,
where it's confusing enough already) but means that the actual meaning
of pcity->client.occupied itself becomes muddled (it doesn't always have
an accurate value).

jason

Index: client/climisc.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v
retrieving revision 1.126
diff -u -r1.126 climisc.c
--- client/climisc.c    2004/01/24 16:45:18     1.126
+++ client/climisc.c    2004/01/26 22:17:16
@@ -99,8 +99,10 @@
 
   pcity = map_get_city(x, y);
   if (pcity) {
-    pcity->client.occupied =
+    if (pplayers_allied(city_owner(pcity), game.player_ptr)) {
+      pcity->client.occupied =
        (unit_list_size(&(map_get_tile(pcity->x, pcity->y)->units)) > 0);
+    }
 
     refresh_city_dialog(pcity);
     freelog(LOG_DEBUG, "map city %s, %s, (%d %d)", pcity->name,

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#7327) another occupied-city bug, Jason Short <=