Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2003:
[Freeciv-Dev] (PR#3603) don't send the capital in short_city
Home

[Freeciv-Dev] (PR#3603) don't send the capital in short_city

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#3603) don't send the capital in short_city
From: "Mike Kaufman" <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 3 Mar 2003 20:07:24 -0800
Reply-to: rt@xxxxxxxxxxxxxx

here's a patch for an issue I mentioned a while back.
 
currently, whenever a player comes into contact with a city, the server
tells that player if the city has a palace in it.

for one, this is bad, because the player really should never know this 
without spying.
for two, this is bad, because the client never actually uses this info:
without hacking the client (AFAIK), the player is blissfully unaware (so if
your "hidden" capital is getting systematically getting attacked on
pubserver, you have an explanation...)
for three, this is bad because the client never removes the improvement
from the city, so a player can end up with enemy city lists full of
palaces.

It compiles, and the game doesn't seem to crash after several turns and
contact, so...

-mike

PS: on a related note, general effects is going to mean that the has_walls
attribute in short_city is going to have to change too: probably a ruleset
attribute that trips this if the city has X% defense bonus.

diff -Nur -Xcvs/diff_ignore cvs/client/packhand.c test-palace/client/packhand.c
--- cvs/client/packhand.c       Sat Feb 22 11:43:21 2003
+++ test-palace/client/packhand.c       Mon Mar  3 21:30:56 2003
@@ -600,8 +600,6 @@
                            ARRAY_SIZE(pcity->improvements));
   }
 
-  update_improvement_from_packet(pcity, B_PALACE, packet->capital,
-                                 &need_effect_update);
   update_improvement_from_packet(pcity, B_CITY, packet->walls,
                                  &need_effect_update);
 
diff -Nur -Xcvs/diff_ignore cvs/common/capstr.c test-palace/common/capstr.c
--- cvs/common/capstr.c Tue Feb 18 09:05:33 2003
+++ test-palace/common/capstr.c Mon Mar  3 21:23:03 2003
@@ -76,7 +76,7 @@
 
 #define CAPABILITY "+1.14.0 conn_info +occupied team tech_impr_gfx " \
                    "city_struct_minor_cleanup obsolete_last class_legend " \
-                   "+impr_req +waste +fastfocus +continent"
+                   "+impr_req +waste +fastfocus +continent +noshortpalace"
   
 /* "+1.14.0" is protocol for 1.14.0 release.
  *
@@ -108,7 +108,10 @@
  *
  * "fastfocus" removes the server from client unit focus.
  *
- * +continent": the server gives the client continent information
+ * "continent": the server gives the client continent information
+ *
+ * "noshortpalace": do not send the palace improvement in the
+ * short_city packet.
  */
 
 void init_our_capability(void)
diff -Nur -Xcvs/diff_ignore cvs/common/packets.c test-palace/common/packets.c
--- cvs/common/packets.c        Tue Feb 18 09:05:33 2003
+++ test-palace/common/packets.c        Mon Mar  3 21:24:35 2003
@@ -1480,9 +1480,8 @@
   dio_put_uint8(&dout, req->size);
 
   dio_put_uint8(&dout, (COND_SET_BIT(req->happy, 0) |
-                       COND_SET_BIT(req->capital, 1) |
-                       COND_SET_BIT(req->walls, 2) |
-                       COND_SET_BIT(req->occupied, 3)));
+                       COND_SET_BIT(req->walls, 1) |
+                       COND_SET_BIT(req->occupied, 2)));
 
   dio_put_uint16(&dout, req->tile_trade);
 
@@ -1508,9 +1507,8 @@
 
   dio_get_uint8(&din, &i);
   packet->happy = TEST_BIT(i, 0);
-  packet->capital = TEST_BIT(i, 1);
-  packet->walls = TEST_BIT(i, 2);
-  packet->occupied = TEST_BIT(i, 3);
+  packet->walls = TEST_BIT(i, 1);
+  packet->occupied = TEST_BIT(i, 2);
 
   dio_get_uint16(&din, &packet->tile_trade);
 
diff -Nur -Xcvs/diff_ignore cvs/common/packets.h test-palace/common/packets.h
--- cvs/common/packets.h        Tue Feb 18 09:05:33 2003
+++ test-palace/common/packets.h        Mon Mar  3 21:23:40 2003
@@ -378,7 +378,6 @@
   char name[MAX_LEN_NAME];
   int size;                    /* uint8 */
   bool happy;                  /* boolean */
-  bool capital;                        /* boolean */
   bool walls;                  /* boolean */
   bool occupied;               /* boolean */
   int tile_trade;              /* same as in packet_city_info */
diff -Nur -Xcvs/diff_ignore cvs/server/citytools.c 
test-palace/server/citytools.c
--- cvs/server/citytools.c      Sun Feb 16 23:23:57 2003
+++ test-palace/server/citytools.c      Mon Mar  3 21:28:03 2003
@@ -1405,11 +1405,6 @@
     packet->happy = TRUE;
   }
 
-  if (pcity && pcity->id == pdcity->id && city_got_building(pcity, B_PALACE))
-    packet->capital = TRUE;
-  else
-    packet->capital = FALSE;
-
   packet->walls = pdcity->has_walls;
   packet->occupied = pdcity->occupied;
 

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