Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2005:
[Freeciv-Dev] (PR#13722) show city owner as border owner
Home

[Freeciv-Dev] (PR#13722) show city owner as border owner

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13722) show city owner as border owner
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 20 Aug 2005 17:19:58 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13722 >

This patch changes the city-sending server code.  If the city owner (in 
the plrcity) differs from the owner of the plrtile the plrtile value is 
used instead.

With the current non-omniscient border system this shouldn't make any 
difference.  With omniscient or partially omniscient borders this will 
fix the bug of incorrectly displayed city owners.

Also included is a new sanity check.

See PR#10191.

-jason

Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.342
diff -p -u -r1.342 citytools.c
--- server/citytools.c  1 Aug 2005 23:09:36 -0000       1.342
+++ server/citytools.c  21 Aug 2005 00:16:51 -0000
@@ -1297,11 +1297,17 @@ This fills out a package from a players 
 static void package_dumb_city(struct player* pplayer, struct tile *ptile,
                              struct packet_city_short_info *packet)
 {
-  struct dumb_city *pdcity = map_get_player_tile(ptile, pplayer)->city;
+  struct player_tile *pdtile = map_get_player_tile(ptile, pplayer);
+  struct dumb_city *pdcity = pdtile->city;
   struct city *pcity = tile_get_city(ptile);
 
   packet->id = pdcity->id;
-  packet->owner = pdcity->owner->player_no;
+  if (pdtile->owner >= 0) {
+    /* Use tile owner information not city owner information. */
+    packet->owner = pdtile->owner;
+  } else {
+    packet->owner = pdcity->owner->player_no;
+  }
   packet->x = ptile->x;
   packet->y = ptile->y;
   sz_strlcpy(packet->name, pdcity->name);
Index: server/sanitycheck.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sanitycheck.c,v
retrieving revision 1.72
diff -p -u -r1.72 sanitycheck.c
--- server/sanitycheck.c        18 Aug 2005 06:53:31 -0000      1.72
+++ server/sanitycheck.c        21 Aug 2005 00:16:52 -0000
@@ -190,6 +190,7 @@ void real_sanity_check_city(struct city 
   SANITY_CHECK(pcity->size >= 1);
   SANITY_CHECK(!terrain_has_flag(tile_get_terrain(pcity->tile),
                           TER_NO_CITIES));
+  SANITY_CHECK(pcity->tile->owner == NULL || pcity->tile->owner == pplayer);
 
   unit_list_iterate(pcity->units_supported, punit) {
     SANITY_CHECK(punit->homecity == pcity->id);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13722) show city owner as border owner, Jason Short <=