Author: cazfi
Date: Sat Jul  2 11:08:07 2016
New Revision: 33143

URL: http://svn.gna.org/viewcvs/freeciv?rev=33143&view=rev
Log:
Renamed variables named 'string' as 'str' in savegame3.c.

See patch #7358

Modified:
    trunk/server/savegame3.c

Modified: trunk/server/savegame3.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame3.c?rev=33143&r1=33142&r2=33143&view=diff
==============================================================================
--- trunk/server/savegame3.c    (original)
+++ trunk/server/savegame3.c    Sat Jul  2 11:08:07 2016
@@ -1803,7 +1803,7 @@
 ****************************************************************************/
 static void sg_load_game(struct loaddata *loading)
 {
-  const char *string;
+  const char *str;
   const char *level;
   int i;
 
@@ -1811,18 +1811,18 @@
   sg_check_ret();
 
   /* Load server state. */
-  string = secfile_lookup_str_default(loading->file, "S_S_INITIAL",
-                                      "game.server_state");
-  loading->server_state = server_states_by_name(string, strcmp);
+  str = secfile_lookup_str_default(loading->file, "S_S_INITIAL",
+                                   "game.server_state");
+  loading->server_state = server_states_by_name(str, strcmp);
   if (!server_states_is_valid(loading->server_state)) {
     /* Don't take any risk! */
     loading->server_state = S_S_INITIAL;
   }
 
-  string = secfile_lookup_str_default(loading->file,
-                                      default_meta_patches_string(),
-                                      "game.meta_patches");
-  set_meta_patches_string(string);
+  str = secfile_lookup_str_default(loading->file,
+                                   default_meta_patches_string(),
+                                   "game.meta_patches");
+  set_meta_patches_string(str);
 
   if (0 == strcmp(DEFAULT_META_SERVER_ADDR, srvarg.metaserver_addr)) {
     /* Do not overwrite this if the user requested a specific metaserver
@@ -1911,18 +1911,18 @@
     = secfile_lookup_int_default(loading->file, 0, "game.coolinglevel");
 
   /* Global advances. */
-  string = secfile_lookup_str_default(loading->file, NULL,
-                                      "game.global_advances");
-  if (string != NULL) {
-    sg_failure_ret(strlen(string) == loading->technology.size,
+  str = secfile_lookup_str_default(loading->file, NULL,
+                                   "game.global_advances");
+  if (str != NULL) {
+    sg_failure_ret(strlen(str) == loading->technology.size,
                    "Invalid length of 'game.global_advances' (%lu ~= %lu).",
-                   (unsigned long) strlen(string),
+                   (unsigned long) strlen(str),
                    (unsigned long) loading->technology.size);
     for (i = 0; i < loading->technology.size; i++) {
-      sg_failure_ret(string[i] == '1' || string[i] == '0',
+      sg_failure_ret(str[i] == '1' || str[i] == '0',
                      "Undefined value '%c' within 'game.global_advances'.",
-                     string[i]);
-      if (string[i] == '1') {
+                     str[i]);
+      if (str[i] == '1') {
         struct advance *padvance =
             advance_by_rule_name(loading->technology.order[i]);
 
@@ -2079,7 +2079,7 @@
   sg_check_ret();
 
   if (secfile_lookup_bool_default(loading->file, FALSE, "random.saved")) {
-    const char *string;
+    const char *str;
     int i;
 
     sg_failure_ret(secfile_lookup_int(loading->file, &loading->rstate.j,
@@ -2090,9 +2090,9 @@
                                       "random.index_X"), "%s", 
secfile_error());
 
     for (i = 0; i < 8; i++) {
-      string = secfile_lookup_str(loading->file, "random.table%d",i);
-      sg_failure_ret(NULL != string, "%s", secfile_error());
-      sscanf(string, "%8x %8x %8x %8x %8x %8x %8x", &loading->rstate.v[7*i],
+      str = secfile_lookup_str(loading->file, "random.table%d",i);
+      sg_failure_ret(NULL != str, "%s", secfile_error());
+      sscanf(str, "%8x %8x %8x %8x %8x %8x %8x", &loading->rstate.v[7*i],
              &loading->rstate.v[7*i+1], &loading->rstate.v[7*i+2],
              &loading->rstate.v[7*i+3], &loading->rstate.v[7*i+4],
              &loading->rstate.v[7*i+5], &loading->rstate.v[7*i+6]);
@@ -3086,7 +3086,7 @@
 static void sg_load_players_basic(struct loaddata *loading)
 {
   int i, k, nplayers;
-  const char *string;
+  const char *str;
   bool shuffle_loaded = TRUE;
 
   /* Check status and return if not OK (sg_success != TRUE). */
@@ -3099,19 +3099,19 @@
   }
 
   /* Load destroyed wonders: */
-  string = secfile_lookup_str(loading->file,
+  str = secfile_lookup_str(loading->file,
                               "players.destroyed_wonders");
-  sg_failure_ret(string != NULL, "%s", secfile_error());
-  sg_failure_ret(strlen(string) == loading->improvement.size,
+  sg_failure_ret(str != NULL, "%s", secfile_error());
+  sg_failure_ret(strlen(str) == loading->improvement.size,
                  "Invalid length for 'players.destroyed_wonders' "
-                 "(%lu ~= %lu)", (unsigned long) strlen(string),
+                 "(%lu ~= %lu)", (unsigned long) strlen(str),
                  (unsigned long) loading->improvement.size);
   for (k = 0; k < loading->improvement.size; k++) {
-    sg_failure_ret(string[k] == '1' || string[k] == '0',
+    sg_failure_ret(str[k] == '1' || str[k] == '0',
                    "Undefined value '%c' within "
-                   "'players.destroyed_wonders'.", string[k]);
-
-    if (string[k] == '1') {
+                   "'players.destroyed_wonders'.", str[k]);
+
+    if (str[k] == '1') {
       struct impr_type *pimprove =
           improvement_by_rule_name(loading->improvement.order[k]);
       if (pimprove) {
@@ -3142,9 +3142,9 @@
     }
 
     /* Get player AI type. */
-    string = secfile_lookup_str(loading->file, "player%d.ai_type",
-                                player_slot_index(pslot));
-    sg_failure_ret(string != NULL, "%s", secfile_error());
+    str = secfile_lookup_str(loading->file, "player%d.ai_type",
+                             player_slot_index(pslot));
+    sg_failure_ret(str != NULL, "%s", secfile_error());
 
     /* Get player color */
     if (!rgbcolor_load(loading->file, &prgbcolor, "player%d.color",
@@ -3161,9 +3161,9 @@
     }
 
     /* Create player. */
-    pplayer = server_create_player(player_slot_index(pslot), string,
+    pplayer = server_create_player(player_slot_index(pslot), str,
                                    prgbcolor, 
game.scenario.allow_ai_type_fallback);
-    sg_failure_ret(pplayer != NULL, "Invalid AI type: '%s'!", string);
+    sg_failure_ret(pplayer != NULL, "Invalid AI type: '%s'!", str);
 
     server_player_init(pplayer, FALSE, FALSE);
 
@@ -3552,7 +3552,7 @@
 {
   const char **slist;
   int i, plrno = player_number(plr);
-  const char *string;
+  const char *str;
   struct government *gov;
   const char *level;
   const char *barb_str;
@@ -3563,9 +3563,9 @@
   sg_check_ret();
 
   /* Basic player data. */
-  string = secfile_lookup_str(loading->file, "player%d.name", plrno);
-  sg_failure_ret(string != NULL, "%s", secfile_error());
-  server_player_set_name(plr, string);
+  str = secfile_lookup_str(loading->file, "player%d.name", plrno);
+  sg_failure_ret(str != NULL, "%s", secfile_error());
+  server_player_set_name(plr, str);
   sz_strlcpy(plr->username,
              secfile_lookup_str_default(loading->file, "",
                                         "player%d.username", plrno));
@@ -3579,12 +3579,12 @@
   sg_failure_ret(secfile_lookup_bool(loading->file, &plr->unassigned_ranked,
                                      "player%d.unassigned_ranked", plrno),
                  "%s", secfile_error());
-  string = secfile_lookup_str_default(loading->file, "",
-                                      "player%d.delegation_username",
-                                      plrno);
+  str = secfile_lookup_str_default(loading->file, "",
+                                   "player%d.delegation_username",
+                                   plrno);
   /* Defaults to no delegation. */
-  if (strlen(string)) {
-    player_delegation_set(plr, string);
+  if (strlen(str)) {
+    player_delegation_set(plr, str);
   }
 
   /* Player flags */
@@ -3599,25 +3599,25 @@
   free(slist);
 
   /* Nation */
-  string = secfile_lookup_str(loading->file, "player%d.nation", plrno);
-  player_set_nation(plr, nation_by_rule_name(string));
+  str = secfile_lookup_str(loading->file, "player%d.nation", plrno);
+  player_set_nation(plr, nation_by_rule_name(str));
   if (plr->nation != NULL) {
     ai_traits_init(plr);
   }
 
   /* Government */
-  string = secfile_lookup_str(loading->file, "player%d.government_name",
-                              plrno);
-  gov = government_by_rule_name(string);
+  str = secfile_lookup_str(loading->file, "player%d.government_name",
+                           plrno);
+  gov = government_by_rule_name(str);
   sg_failure_ret(gov != NULL, "Player%d: unsupported government \"%s\".",
-                 plrno, string);
+                 plrno, str);
   plr->government = gov;
 
   /* Target government */
-  string = secfile_lookup_str(loading->file,
-                              "player%d.target_government_name", plrno);
-  if (string) {
-    plr->target_government = government_by_rule_name(string);
+  str = secfile_lookup_str(loading->file,
+                           "player%d.target_government_name", plrno);
+  if (str != NULL) {
+    plr->target_government = government_by_rule_name(str);
   } else {
     plr->target_government = NULL;
   }
@@ -3732,14 +3732,14 @@
   {
     struct nation_style *style;
 
-    string = secfile_lookup_str(loading->file, "player%d.style_by_name", 
plrno);
-
-    sg_failure_ret(string != NULL, "%s", secfile_error());
-    style = style_by_rule_name(string);
+    str = secfile_lookup_str(loading->file, "player%d.style_by_name", plrno);
+
+    sg_failure_ret(str != NULL, "%s", secfile_error());
+    style = style_by_rule_name(str);
     if (style == NULL) {
       style = style_by_number(0);
       log_sg("Player%d: unsupported city_style_name \"%s\". "
-             "Changed to \"%s\".", plrno, string, style_rule_name(style));
+             "Changed to \"%s\".", plrno, str, style_rule_name(style));
     }
     plr->style = style;
   }
@@ -3982,20 +3982,20 @@
   }
 
   /* Load lost wonder data. */
-  string = secfile_lookup_str(loading->file, "player%d.lost_wonders", plrno);
+  str = secfile_lookup_str(loading->file, "player%d.lost_wonders", plrno);
   /* If not present, probably an old savegame; nothing to be done */
-  if (string) {
+  if (str != NULL) {
     int k;
-    sg_failure_ret(strlen(string) == loading->improvement.size,
+    sg_failure_ret(strlen(str) == loading->improvement.size,
                    "Invalid length for 'player%d.lost_wonders' "
-                   "(%lu ~= %lu)", plrno, (unsigned long) strlen(string),
+                   "(%lu ~= %lu)", plrno, (unsigned long) strlen(str),
                    (unsigned long) loading->improvement.size);
     for (k = 0; k < loading->improvement.size; k++) {
-      sg_failure_ret(string[k] == '1' || string[k] == '0',
+      sg_failure_ret(str[k] == '1' || str[k] == '0',
                      "Undefined value '%c' within "
-                     "'player%d.lost_wonders'.", plrno, string[k]);
-
-      if (string[k] == '1') {
+                     "'player%d.lost_wonders'.", plrno, str[k]);
+
+      if (str[k] == '1') {
         struct impr_type *pimprove =
             improvement_by_rule_name(loading->improvement.order[k]);
         if (pimprove) {
@@ -4424,7 +4424,7 @@
                                 struct city *pcity, const char *citystr)
 {
   struct player *past;
-  const char *kind, *name, *string;
+  const char *kind, *name, *str;
   int id, i, repair, sp_count = 0, workers = 0, value;
   int nat_x, nat_y;
   citizens size;
@@ -4590,18 +4590,18 @@
   }
 
   /* Load city improvements. */
-  string = secfile_lookup_str(loading->file, "%s.improvements", citystr);
-  sg_warn_ret_val(string != NULL, FALSE, "%s", secfile_error());
-  sg_warn_ret_val(strlen(string) == loading->improvement.size, FALSE,
+  str = secfile_lookup_str(loading->file, "%s.improvements", citystr);
+  sg_warn_ret_val(str != NULL, FALSE, "%s", secfile_error());
+  sg_warn_ret_val(strlen(str) == loading->improvement.size, FALSE,
                   "Invalid length of '%s.improvements' (%lu ~= %lu).",
-                  citystr, (unsigned long) strlen(string),
+                  citystr, (unsigned long) strlen(str),
                   (unsigned long) loading->improvement.size);
   for (i = 0; i < loading->improvement.size; i++) {
-    sg_warn_ret_val(string[i] == '1' || string[i] == '0', FALSE,
+    sg_warn_ret_val(str[i] == '1' || str[i] == '0', FALSE,
                    "Undefined value '%c' within '%s.improvements'.",
-                   string[i], citystr)
-
-    if (string[i] == '1') {
+                   str[i], citystr)
+
+    if (str[i] == '1') {
       struct impr_type *pimprove =
           improvement_by_rule_name(loading->improvement.order[i]);
       if (pimprove) {
@@ -6121,7 +6121,7 @@
                                        struct vision_site *pdcity,
                                        const char *citystr)
 {
-  const char *string;
+  const char *str;
   int i, id, size;
   citizens city_size;
   int nat_x, nat_y;
@@ -6160,18 +6160,18 @@
 
   /* Initialise list of improvements */
   BV_CLR_ALL(pdcity->improvements);
-  string = secfile_lookup_str(loading->file, "%s.improvements", citystr);
-  sg_warn_ret_val(string != NULL, FALSE, "%s", secfile_error());
-  sg_warn_ret_val(strlen(string) == loading->improvement.size, FALSE,
+  str = secfile_lookup_str(loading->file, "%s.improvements", citystr);
+  sg_warn_ret_val(str != NULL, FALSE, "%s", secfile_error());
+  sg_warn_ret_val(strlen(str) == loading->improvement.size, FALSE,
                   "Invalid length of '%s.improvements' (%lu ~= %lu).",
-                  citystr, (unsigned long) strlen(string),
+                  citystr, (unsigned long) strlen(str),
                   (unsigned long) loading->improvement.size);
   for (i = 0; i < loading->improvement.size; i++) {
-    sg_warn_ret_val(string[i] == '1' || string[i] == '0', FALSE,
+    sg_warn_ret_val(str[i] == '1' || str[i] == '0', FALSE,
                     "Undefined value '%c' within '%s.improvements'.",
-                    string[i], citystr)
-
-    if (string[i] == '1') {
+                    str[i], citystr)
+
+    if (str[i] == '1') {
       struct impr_type *pimprove =
           improvement_by_rule_name(loading->improvement.order[i]);
       if (pimprove) {
@@ -6382,7 +6382,7 @@
   struct research *presearch;
   int count;
   int number;
-  const char *string;
+  const char *str;
   int i, j;
 
   /* Check status and return if not OK (sg_success != TRUE). */
@@ -6431,19 +6431,18 @@
                                        "research.r%d.got_tech", i),
                    "%s", secfile_error());
 
-    string = secfile_lookup_str(loading->file, "research.r%d.done",
-                                i);
-    sg_failure_ret(string != NULL, "%s", secfile_error());
-    sg_failure_ret(strlen(string) == loading->technology.size,
+    str = secfile_lookup_str(loading->file, "research.r%d.done", i);
+    sg_failure_ret(str != NULL, "%s", secfile_error());
+    sg_failure_ret(strlen(str) == loading->technology.size,
                    "Invalid length of 'research.r%d.done' (%lu ~= %lu).",
-                   i, (unsigned long) strlen(string),
+                   i, (unsigned long) strlen(str),
                    (unsigned long) loading->technology.size);
     for (j = 0; j < loading->technology.size; j++) {
-      sg_failure_ret(string[j] == '1' || string[j] == '0',
+      sg_failure_ret(str[j] == '1' || str[j] == '0',
                      "Undefined value '%c' within 'research.r%d.done'.",
-                     string[j], i);
-
-      if (string[j] == '1') {
+                     str[j], i);
+
+      if (str[j] == '1') {
         struct advance *padvance =
             advance_by_rule_name(loading->technology.order[j]);
 


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

Reply via email to