Author: cazfi
Date: Sun Jun 26 20:56:59 2016
New Revision: 33048

URL: http://svn.gna.org/viewcvs/freeciv?rev=33048&view=rev
Log:
Separated MAX_LEN_CITYNAME from MAX_LEN_NAME, increased its value to 80.

See patch #7305

Modified:
    trunk/client/packhand.c
    trunk/common/city.h
    trunk/common/fc_types.h
    trunk/common/networking/packets.def
    trunk/fc_version
    trunk/server/citytools.c
    trunk/server/ruleset.c

Modified: trunk/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/packhand.c?rev=33048&r1=33047&r2=33048&view=diff
==============================================================================
--- trunk/client/packhand.c     (original)
+++ trunk/client/packhand.c     Sun Jun 26 20:56:59 2016
@@ -2861,12 +2861,12 @@
   }
 
   if (NULL == tile_worked(ptile)
-   || tile_worked(ptile)->id != packet->worked) {
+      || tile_worked(ptile)->id != packet->worked) {
     if (IDENTITY_NUMBER_ZERO != packet->worked) {
       struct city *pwork = game_city_by_number(packet->worked);
 
       if (NULL == pwork) {
-        char named[MAX_LEN_NAME];
+        char named[MAX_LEN_CITYNAME];
 
         /* new unseen city, or before city_info */
         fc_snprintf(named, sizeof(named), "%06u", packet->worked);

Modified: trunk/common/city.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/city.h?rev=33048&r1=33047&r2=33048&view=diff
==============================================================================
--- trunk/common/city.h (original)
+++ trunk/common/city.h Sun Jun 26 20:56:59 2016
@@ -303,7 +303,7 @@
 struct adv_city; /* defined in ./server/advisors/infracache.h */
 
 struct city {
-  char name[MAX_LEN_NAME];
+  char name[MAX_LEN_CITYNAME];
   struct tile *tile; /* May be NULL, should check! */
   struct player *owner; /* Cannot be NULL. */
   struct player *original; /* Cannot be NULL. */

Modified: trunk/common/fc_types.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/fc_types.h?rev=33048&r1=33047&r2=33048&view=diff
==============================================================================
--- trunk/common/fc_types.h     (original)
+++ trunk/common/fc_types.h     Sun Jun 26 20:56:59 2016
@@ -64,6 +64,7 @@
 
 /* Changing these will probably break network compatability. */
 #define MAX_LEN_NAME     48
+#define MAX_LEN_CITYNAME 80
 #define MAX_LEN_DEMOGRAPHY 16
 #define MAX_LEN_ALLOW_TAKE 16
 #define MAX_LEN_GAME_IDENTIFIER 33

Modified: trunk/common/networking/packets.def
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/networking/packets.def?rev=33048&r1=33047&r2=33048&view=diff
==============================================================================
--- trunk/common/networking/packets.def (original)
+++ trunk/common/networking/packets.def Sun Jun 26 20:56:59 2016
@@ -699,7 +699,7 @@
 
   BV_IMPRS improvements;
   BV_CITY_OPTIONS city_options;
-  ESTRING name[MAX_LEN_NAME];
+  ESTRING name[MAX_LEN_CITYNAME];
 end
 
 PACKET_CITY_SHORT_INFO = 32; sc, lsend, is-game-info, cancel(PACKET_CITY_INFO)
@@ -719,7 +719,7 @@
   SINT8 city_image;
 
   BV_IMPRS improvements;
-  ESTRING name[MAX_LEN_NAME];
+  ESTRING name[MAX_LEN_CITYNAME];
 end
 
 PACKET_TRADEROUTE_INFO = 249; sc, lsend, handle-via-packet
@@ -768,7 +768,7 @@
 
 PACKET_CITY_RENAME = 40; cs, dsend
   CITY city_id;
-  ESTRING name[MAX_LEN_NAME];
+  ESTRING name[MAX_LEN_CITYNAME];
 end
 
 PACKET_CITY_OPTIONS_REQ = 41; cs, dsend
@@ -792,7 +792,7 @@
 
 PACKET_CITY_NAME_SUGGESTION_INFO = 44; sc, dsend, lsend
   UNIT unit_id;
-  ESTRING name[MAX_LEN_NAME];
+  ESTRING name[MAX_LEN_CITYNAME];
 end
 
 PACKET_CITY_SABOTAGE_LIST = 45; sc, lsend
@@ -2088,7 +2088,7 @@
 
 PACKET_EDIT_CITY = 213; cs, handle-per-conn, handle-via-packet
   CITY id; key
-  ESTRING name[MAX_LEN_NAME];
+  ESTRING name[MAX_LEN_CITYNAME];
   PLAYER owner;
   PLAYER original;
   UINT8 size;

Modified: trunk/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=33048&r1=33047&r2=33048&view=diff
==============================================================================
--- trunk/fc_version    (original)
+++ trunk/fc_version    Sun Jun 26 20:56:59 2016
@@ -56,7 +56,7 @@
 #   - Avoid adding a new mandatory capability to the development branch for
 #     as long as possible.  We want to maintain network compatibility with
 #     the stable branch for as long as possible.
-NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2016.Jun.25"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2016.Jun.26"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""

Modified: trunk/server/citytools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/citytools.c?rev=33048&r1=33047&r2=33048&view=diff
==============================================================================
--- trunk/server/citytools.c    (original)
+++ trunk/server/citytools.c    Sun Jun 26 20:56:59 2016
@@ -538,12 +538,12 @@
 
   /* Not found in rulesets, make a default name. */
   {
-    static char tempname[MAX_LEN_NAME];
+    static char tempname[MAX_LEN_CITYNAME];
     int i;
 
     log_debug("City name not found in rulesets.");
     for (i = 1; i <= map_num_tiles(); i++ ) {
-      fc_snprintf(tempname, MAX_LEN_NAME, _("City no. %d"), i);
+      fc_snprintf(tempname, MAX_LEN_CITYNAME, _("City no. %d"), i);
       if (NULL == game_city_by_name(tempname)) {
         return tempname;
       }
@@ -1060,7 +1060,7 @@
                   int kill_outside, bool transfer_unit_verbose,
                   bool resolve_stack, bool raze, bool build_free)
 {
-  char old_city_name[MAX_LEN_NAME];
+  char old_city_name[MAX_LEN_CITYNAME];
   bv_imprs had_small_wonders;
   struct vision *old_vision, *new_vision;
   struct unit_list *old_city_units = unit_list_new();

Modified: trunk/server/ruleset.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.c?rev=33048&r1=33047&r2=33048&view=diff
==============================================================================
--- trunk/server/ruleset.c      (original)
+++ trunk/server/ruleset.c      Sun Jun 26 20:56:59 2016
@@ -107,6 +107,7 @@
 #define MULTIPLIER_SECTION_PREFIX "multiplier_"
 
 #define check_name(name) (check_strlen(name, MAX_LEN_NAME, NULL))
+#define check_cityname(name) (check_strlen(name, MAX_LEN_CITYNAME, NULL))
 
 /* avoid re-reading files */
 static const char name_too_long[] = "Name \"%s\" too long; truncating.";
@@ -3973,14 +3974,14 @@
 
     /* Build the nation_city. */
     remove_leading_trailing_spaces(city_name);
-    if (check_name(city_name)) {
+    if (check_cityname(city_name)) {
       /* The ruleset contains a name that is too long. This shouldn't
        * happen - if it does, the author should get immediate feedback. */
       ruleset_error(LOG_ERROR, "\"%s\" [%s] %s: city name \"%s\" "
                     "is too long.", secfile_name(file),
                     secfile_str1, secfile_str2, city_name);
       ok = FALSE;
-      city_name[MAX_LEN_NAME - 1] = '\0';
+      city_name[MAX_LEN_CITYNAME - 1] = '\0';
     }
     pncity = nation_city_new(pnation, city_name);
 


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to