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

 First step toward fixing #37977. Server decides if wall gfx should be
drawn and sends that information to client.
 This does change how Great Wall effects appear. Previously client
knew that even fogged cities get walls when player builds Great Wall
and lose walls when it gets obsolete. Now player knowledge about
fogged cities is not updated.

 This patch is for trunk only as it adds mandatory capability.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/gui-sdl/mapview.c freeciv/client/gui-sdl/mapview.c
--- freeciv/client/gui-sdl/mapview.c	2007-03-05 21:12:14.000000000 +0200
+++ freeciv/client/gui-sdl/mapview.c	2007-03-12 01:50:16.000000000 +0200
@@ -774,7 +774,7 @@
 			  
 	    cat_snprintf(buffer, sizeof(buffer), _("\nCity of %s"), pTile->city->name);
             	  
-	    citywall = city_got_citywalls(pTile->city);
+	    citywall = pTile->city->client.walls;
                           
 #if 0                          
 	    if (pplayers_allied(game.player_ptr, pOwner)) {
diff -Nurd -X.diff_ignore freeciv/client/packhand.c freeciv/client/packhand.c
--- freeciv/client/packhand.c	2007-03-09 16:12:48.000000000 +0200
+++ freeciv/client/packhand.c	2007-03-12 01:46:08.000000000 +0200
@@ -568,6 +568,8 @@
     agents_city_changed(pcity);
   }
 
+  pcity->client.walls = packet->walls;
+
   handle_city_packet_common(pcity, city_is_new, popup,
 			    packet->diplomat_investigate);
 
@@ -788,6 +790,8 @@
     agents_city_changed(pcity);
   }
 
+  pcity->client.walls = packet->walls;
+
   handle_city_packet_common(pcity, city_is_new, FALSE, FALSE);
 
   /* Update the description if necessary. */
diff -Nurd -X.diff_ignore freeciv/client/tilespec.c freeciv/client/tilespec.c
--- freeciv/client/tilespec.c	2007-03-08 20:59:09.000000000 +0200
+++ freeciv/client/tilespec.c	2007-03-12 01:49:24.000000000 +0200
@@ -4167,16 +4167,16 @@
       /* For iso-view the city.wall graphics include the full city, whereas
        * for non-iso view they are an overlay on top of the base city
        * graphic. */
-      if (!t->is_isometric || !city_got_citywalls(pcity)) {
+      if (!t->is_isometric || !pcity->client.walls) {
 	ADD_SPRITE_FULL(get_city_sprite(t->sprites.city.tile, pcity));
       }
-      if (t->is_isometric && city_got_citywalls(pcity)) {
+      if (t->is_isometric && pcity->client.walls) {
 	ADD_SPRITE_FULL(get_city_sprite(t->sprites.city.wall, pcity));
       }
       if (!draw_full_citybar && pcity->client.occupied) {
 	ADD_SPRITE_FULL(get_city_sprite(t->sprites.city.occupied, pcity));
       }
-      if (!t->is_isometric && city_got_citywalls(pcity)) {
+      if (!t->is_isometric && pcity->client.walls) {
 	ADD_SPRITE_FULL(get_city_sprite(t->sprites.city.wall, pcity));
       }
       if (pcity->client.unhappy) {
diff -Nurd -X.diff_ignore freeciv/common/city.h freeciv/common/city.h
--- freeciv/common/city.h	2007-03-05 21:11:49.000000000 +0200
+++ freeciv/common/city.h	2007-03-12 01:36:25.000000000 +0200
@@ -268,6 +268,8 @@
     /* The color is an index into the city_colors array in mapview_common */
     bool colored;
     int color_index;
+
+    bool walls;
   } client;
 
   int steal;		      /* diplomats steal once; for spies, gets harder */
diff -Nurd -X.diff_ignore freeciv/common/packets.def freeciv/common/packets.def
--- freeciv/common/packets.def	2007-03-09 16:12:48.000000000 +0200
+++ freeciv/common/packets.def	2007-03-12 01:38:57.000000000 +0200
@@ -542,6 +542,8 @@
 
   BV_CITY_OPTIONS city_options;
   TURN turn_founded;
+
+  BOOL walls;
 end
 
 PACKET_CITY_SHORT_INFO=22; sc,lsend
@@ -555,6 +557,7 @@
   BOOL unhappy;
   BV_IMPRS improvements;
   BOOL occupied;
+  BOOL walls;
   UINT16 tile_trade;
 end
 
diff -Nurd -X.diff_ignore freeciv/server/citytools.c freeciv/server/citytools.c
--- freeciv/server/citytools.c	2007-03-08 18:42:39.000000000 +0200
+++ freeciv/server/citytools.c	2007-03-12 01:38:05.000000000 +0200
@@ -1342,6 +1342,7 @@
   packet->size = pdcity->size;
 
   packet->occupied = pdcity->occupied;
+  packet->walls = pdcity->walls;
   packet->happy = pdcity->happy;
   packet->unhappy = pdcity->unhappy;
 
@@ -1634,6 +1635,8 @@
       BV_SET(packet->improvements, i);
     }
   } impr_type_iterate_end;
+
+  packet->walls = city_got_citywalls(pcity);
 }
 
 /**************************************************************************
@@ -1655,6 +1658,7 @@
    * unit list to check the occupied status. */
   bool occupied =
     (unit_list_size(pcity->tile->units) > 0);
+  bool walls = city_got_citywalls(pcity);
   bool happy = city_happy(pcity), unhappy = city_unhappy(pcity);
   bv_imprs improvements;
 
@@ -1670,6 +1674,7 @@
       && strcmp(pdcity->name, pcity->name) == 0
       && pdcity->size == pcity->size
       && pdcity->occupied == occupied
+      && pdcity->walls == walls
       && pdcity->happy == happy
       && pdcity->unhappy == unhappy
       && pdcity->owner == pcity->owner
@@ -1690,6 +1695,7 @@
   sz_strlcpy(pdcity->name, pcity->name);
   pdcity->size = pcity->size;
   pdcity->occupied = occupied;
+  pdcity->walls = walls;
   pdcity->happy = happy;
   pdcity->unhappy = unhappy;
   pdcity->owner = pcity->owner;
diff -Nurd -X.diff_ignore freeciv/server/maphand.h freeciv/server/maphand.h
--- freeciv/server/maphand.h	2007-03-08 18:42:39.000000000 +0200
+++ freeciv/server/maphand.h	2007-03-12 01:36:37.000000000 +0200
@@ -28,6 +28,7 @@
    * pointers in here. */
   int id;
   bool occupied;
+  bool walls;
   bool happy, unhappy;
   char name[MAX_LEN_NAME];
   unsigned short size;
diff -Nurd -X.diff_ignore freeciv/server/savegame.c freeciv/server/savegame.c
--- freeciv/server/savegame.c	2007-03-10 22:49:04.000000000 +0200
+++ freeciv/server/savegame.c	2007-03-12 01:51:04.000000000 +0200
@@ -2631,6 +2631,8 @@
 	pdcity->size = secfile_lookup_int(file, "player%d.dc%d.size", plrno, j);
 	pdcity->occupied = secfile_lookup_bool_default(file, FALSE,
 					"player%d.dc%d.occupied", plrno, j);
+        pdcity->walls = secfile_lookup_bool_default(file, FALSE,
+                                        "player%d.dc%d.walls", plrno, j);
 	pdcity->happy = secfile_lookup_bool_default(file, FALSE,
 					"player%d.dc%d.happy", plrno, j);
 	pdcity->unhappy = secfile_lookup_bool_default(file, FALSE,
@@ -3236,6 +3238,8 @@
 			      "player%d.dc%d.has_walls", plrno, i);
 	  secfile_insert_bool(file, pdcity->occupied,
 			      "player%d.dc%d.occupied", plrno, i);
+          secfile_insert_bool(file, pdcity->walls,
+                              "player%d.dc%d.walls", plrno, i);
 	  secfile_insert_bool(file, pdcity->happy,
 			      "player%d.dc%d.happy", plrno, i);
 	  secfile_insert_bool(file, pdcity->unhappy,
diff -Nurd -X.diff_ignore freeciv/version.in freeciv/version.in
--- freeciv/version.in	2007-03-09 16:12:48.000000000 +0200
+++ freeciv/version.in	2007-03-12 01:28:47.000000000 +0200
@@ -24,4 +24,4 @@
 #   - Avoid adding a new manditory capbility to the development branch for
 #     as long as possible.  We want to maintain network compatibility with
 #     the stable branch for as long as possible.
-FREECIV_NETWORK_CAPSTRING("+Freeciv.Devel.2007.Mar.09-2")
+FREECIV_NETWORK_CAPSTRING("+Freeciv.Devel.2007.Mar.12")
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to