Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2005:
[Freeciv-Dev] (PR#13578) rename terrain_name as name
Home

[Freeciv-Dev] (PR#13578) rename terrain_name as name

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13578) rename terrain_name as name
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 31 Jul 2005 11:11:52 -0700
Reply-to: bugs@xxxxxxxxxxx

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

This patch renames

  pterrain->terrain_name -> pterrain->name
  pterrain->terrain_name_orig -> pterrain->name_orig

to be consistent with every other type we have.  It is
search-and-replace except:

- I renamed the packet field from name to name_orig.

- I fixed a bug I noticed in the get_terrain_color() that I just
introduced - it used the translated name by mistake.

-jason

Index: client/colors_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/colors_common.c,v
retrieving revision 1.7
diff -p -u -r1.7 colors_common.c
--- client/colors_common.c      31 Jul 2005 16:23:13 -0000      1.7
+++ client/colors_common.c      31 Jul 2005 18:07:39 -0000
@@ -174,12 +174,12 @@ void color_system_setup_terrain(struct c
                                const struct terrain *pterrain)
 {
   struct rgbcolor *rgb
-    = hash_lookup_data(colors->terrain_hash, pterrain->terrain_name);
+    = hash_lookup_data(colors->terrain_hash, pterrain->name);
 
   if (rgb) {
     colors->terrain_colors[pterrain->index] = *rgb;
   } else {
-    freelog(LOG_ERROR, "No color for terrain '%s'", pterrain->terrain_name);
+    freelog(LOG_ERROR, "No color for terrain '%s'", pterrain->name);
     /* Fallback: the color remains black. */
   }
 }
Index: client/helpdata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/helpdata.c,v
retrieving revision 1.121
diff -p -u -r1.121 helpdata.c
--- client/helpdata.c   24 Jul 2005 17:01:34 -0000      1.121
+++ client/helpdata.c   31 Jul 2005 18:07:40 -0000
@@ -120,24 +120,24 @@ static void insert_generated_table(const
     strcat(outbuf, "---------------------------------------------------"
           "------------\n");
     terrain_type_iterate(pterrain) {
-      if (*(pterrain->terrain_name) != '\0') {
+      if (*(pterrain->name) != '\0') {
        outbuf = strchr(outbuf, '\0');
        sprintf(outbuf,
                "%-10s %3d    %3d %-10s %3d %-10s %3d %-10s\n",
-               pterrain->terrain_name,
+               pterrain->name,
                pterrain->road_time,
                pterrain->irrigation_time,
                ((pterrain->irrigation_result == pterrain
                  || pterrain->irrigation_result == T_NONE) ? ""
-                : pterrain->irrigation_result->terrain_name),
+                : pterrain->irrigation_result->name),
                pterrain->mining_time,
                ((pterrain->mining_result == pterrain
                  || pterrain->mining_result == T_NONE) ? ""
-                : pterrain->mining_result->terrain_name),
+                : pterrain->mining_result->name),
                pterrain->transform_time,
                ((pterrain->transform_result == pterrain
                 || pterrain->transform_result == T_NONE) ? ""
-                : pterrain->transform_result->terrain_name));
+                : pterrain->transform_result->name));
       }
     } terrain_type_iterate_end;
     strcat(outbuf, "\n");
@@ -178,7 +178,7 @@ static void insert_requirement(struct re
     return;
   case REQ_TERRAIN:
     cat_snprintf(buf, bufsz, _("Requires the %s terrain.\n\n"),
-                get_terrain_name(req->source.value.terrain));
+                get_name(req->source.value.terrain));
     return;
   case REQ_NATION:
     cat_snprintf(buf, bufsz, _("Requires the %s nation.\n\n"),
@@ -386,10 +386,10 @@ void boot_help_texts(void)
          } tech_type_iterate_end;
        } else if (current_type == HELP_TERRAIN) {
          terrain_type_iterate(pterrain) {
-           if (*(pterrain->terrain_name) != '\0') {
+           if (*(pterrain->name) != '\0') {
              pitem = new_help_item(current_type);
              my_snprintf(name, sizeof(name), " %s",
-                         pterrain->terrain_name);
+                         pterrain->name);
              pitem->topic = mystrdup(name);
              pitem->text = mystrdup("");
              help_list_append(category_nodes, pitem);
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.540
diff -p -u -r1.540 packhand.c
--- client/packhand.c   30 Jul 2005 05:10:00 -0000      1.540
+++ client/packhand.c   31 Jul 2005 18:07:40 -0000
@@ -2287,8 +2287,8 @@ void handle_ruleset_terrain(struct packe
     return;
   }
 
-  sz_strlcpy(pterrain->terrain_name_orig, p->terrain_name);
-  pterrain->terrain_name = pterrain->terrain_name_orig;
+  sz_strlcpy(pterrain->name_orig, p->name_orig);
+  pterrain->name = pterrain->name_orig;
   sz_strlcpy(pterrain->graphic_str, p->graphic_str);
   sz_strlcpy(pterrain->graphic_alt, p->graphic_alt);
   pterrain->movement_cost = p->movement_cost;
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.319
diff -p -u -r1.319 tilespec.c
--- client/tilespec.c   31 Jul 2005 16:23:13 -0000      1.319
+++ client/tilespec.c   31 Jul 2005 18:07:41 -0000
@@ -2395,7 +2395,7 @@ void tileset_setup_tile_type(struct tile
   char buffer1[MAX_LEN_NAME + 20];
   int i, l;
   
-  if (pterrain->terrain_name[0] == '\0') {
+  if (pterrain->name[0] == '\0') {
     return;
   }
 
@@ -2405,7 +2405,7 @@ void tileset_setup_tile_type(struct tile
     if (!draw) {
       freelog(LOG_FATAL, "No graphics %s or %s for %s terrain.",
              pterrain->graphic_str, pterrain->graphic_alt,
-             pterrain->terrain_name);
+             pterrain->name);
       exit(EXIT_FAILURE);
     }
   }
@@ -2442,7 +2442,7 @@ void tileset_setup_tile_type(struct tile
                      "t.%s_%s", draw->name, cardinal_index_str(t, i));
          draw->layer[l].match[i] = lookup_sprite_tag_alt(t, buffer1, "", TRUE,
                                                          "tile_type",
-                                                         
pterrain->terrain_name);
+                                                         pterrain->name);
        }
        draw->layer[l].base.p[0] = draw->layer[l].match[0];
        break;
@@ -2473,7 +2473,7 @@ void tileset_setup_tile_type(struct tile
                          (value >> 2) & 1);
              draw->layer[l].cells[i]
                = lookup_sprite_tag_alt(t, buffer1, "", TRUE, "tile_type",
-                                       pterrain->terrain_name);
+                                       pterrain->name);
              break;
            case MATCH_FULL:
              {
@@ -2549,7 +2549,7 @@ void tileset_setup_tile_type(struct tile
        my_snprintf(buffer1, sizeof(buffer1), "t.%s1", draw->name);
        draw->layer[l].base.p[0]
          = lookup_sprite_tag_alt(t, buffer1, "", FALSE, "tile_type",
-                                 pterrain->terrain_name);
+                                 pterrain->name);
        break;
       }
     }
Index: client/gui-ftwl/gui_text.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-ftwl/gui_text.c,v
retrieving revision 1.14
diff -p -u -r1.14 gui_text.c
--- client/gui-ftwl/gui_text.c  26 Jul 2005 16:35:57 -0000      1.14
+++ client/gui-ftwl/gui_text.c  31 Jul 2005 18:07:41 -0000
@@ -297,19 +297,19 @@ const char *mapview_get_unit_action_tool
   if ((tinfo->irrigation_result != T_LAST)
       && (tinfo->irrigation_result != ttype)) {
     my_snprintf(irrtext, sizeof(irrtext), irrfmt,
-               (get_terrain(tinfo->irrigation_result))->terrain_name);
+               (get_terrain(tinfo->irrigation_result))->name);
   } else if (tile_has_special(punit->tile, S_IRRIGATION)
             && player_knows_techs_with_flag(game.player_ptr, TF_FARMLAND)) {
     sz_strlcpy(irrtext, _("Bu_ild Farmland"));
   }
   if ((tinfo->mining_result != T_LAST) && (tinfo->mining_result != ttype)) {
     my_snprintf(mintext, sizeof(mintext), minfmt,
-               (get_terrain(tinfo->mining_result))->terrain_name);
+               (get_terrain(tinfo->mining_result))->name);
   }
   if ((tinfo->transform_result != T_LAST)
       && (tinfo->transform_result != ttype)) {
     my_snprintf(transtext, sizeof(transtext), transfmt,
-               (get_terrain(tinfo->transform_result))->terrain_name);
+               (get_terrain(tinfo->transform_result))->name);
   }
 
   menus_rename("<main>/_Orders/Build _Irrigation", irrtext);
Index: client/gui-gtk-2.0/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/helpdlg.c,v
retrieving revision 1.59
diff -p -u -r1.59 helpdlg.c
--- client/gui-gtk-2.0/helpdlg.c        26 Jul 2005 03:02:02 -0000      1.59
+++ client/gui-gtk-2.0/helpdlg.c        31 Jul 2005 18:07:42 -0000
@@ -1094,7 +1094,7 @@ static void help_update_terrain(const st
       }
     } else if (pterrain->irrigation_result != T_NONE) {
       sprintf(buf, "%s / %d",
-             pterrain->irrigation_result->terrain_name,
+             pterrain->irrigation_result->name,
              pterrain->irrigation_time);
     }
     gtk_label_set_text(GTK_LABEL(help_tlabel[2][4]), buf);
@@ -1108,14 +1108,14 @@ static void help_update_terrain(const st
       }
     } else if (pterrain->mining_result != T_NONE) {
       sprintf(buf, "%s / %d",
-             pterrain->mining_result->terrain_name,
+             pterrain->mining_result->name,
              pterrain->mining_time);
     }
     gtk_label_set_text(GTK_LABEL(help_tlabel[3][1]), buf);
 
     if (pterrain->transform_result != T_NONE) {
       sprintf(buf, "%s / %d",
-             pterrain->transform_result->terrain_name,
+             pterrain->transform_result->name,
              pterrain->transform_time);
     } else {
       strcpy(buf, "n/a");
Index: client/gui-mui/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/gui_main.c,v
retrieving revision 1.98
diff -p -u -r1.98 gui_main.c
--- client/gui-mui/gui_main.c   9 Jul 2005 17:46:07 -0000       1.98
+++ client/gui-mui/gui_main.c   31 Jul 2005 18:07:42 -0000
@@ -1299,7 +1299,7 @@ void update_menus(void) /* from menu.c *
       if ((tinfo->irrigation_result != T_NONE)
          && (tinfo->irrigation_result != ttype)) {
        my_snprintf(irrtext, sizeof(irrtext), chgfmt,
-                   (get_terrain(tinfo->irrigation_result))->terrain_name);
+                   (get_terrain(tinfo->irrigation_result))->name);
       } else if (tile_has_special(punit->tile, S_IRRIGATION)
                 && player_knows_techs_with_flag(game.player_ptr,
                                                 TF_FARMLAND)) {
@@ -1311,7 +1311,7 @@ void update_menus(void) /* from menu.c *
       if ((tinfo->mining_result != T_NONE)
          && (tinfo->mining_result != ttype)) {
        my_snprintf(mintext, sizeof(mintext), chgfmt,
-                   (get_terrain(tinfo->mining_result))->terrain_name);
+                   (get_terrain(tinfo->mining_result))->name);
       } else {
         sz_strlcpy(mintext, _("Build Mine"));
       }
@@ -1319,7 +1319,7 @@ void update_menus(void) /* from menu.c *
       if ((tinfo->transform_result != T_NONE)
          && (tinfo->transform_result != ttype)) {
        my_snprintf(transtext, sizeof(transtext), chgfmt,
-                   (get_terrain(tinfo->transform_result))->terrain_name);
+                   (get_terrain(tinfo->transform_result))->name);
       } else {
         sz_strlcpy(transtext, _("Transform Terrain"));
       }
Index: client/gui-sdl/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/dialogs.c,v
retrieving revision 1.64
diff -p -u -r1.64 dialogs.c
--- client/gui-sdl/dialogs.c    9 Jul 2005 17:46:08 -0000       1.64
+++ client/gui-sdl/dialogs.c    31 Jul 2005 18:07:42 -0000
@@ -827,7 +827,7 @@ const char *sdl_map_get_tile_info_text(s
   static char s[128];
   bool first;
     
-  my_snprintf(s, sizeof(s), "%s", terrains[pTile->terrain].terrain_name);
+  my_snprintf(s, sizeof(s), "%s", terrains[pTile->terrain].name);
   if((pTile->special & S_RIVER) == S_RIVER) {
     sz_strlcat(s, "/");
     sz_strlcat(s, get_special_name(S_RIVER));
Index: client/gui-sdl/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/menu.c,v
retrieving revision 1.31
diff -p -u -r1.31 menu.c
--- client/gui-sdl/menu.c       9 Jul 2005 17:46:08 -0000       1.31
+++ client/gui-sdl/menu.c       31 Jul 2005 18:07:42 -0000
@@ -1028,7 +1028,7 @@ void update_menus(void)
          my_snprintf(cBuf, sizeof(cBuf),"%s %s%s %d %s",
                        _("Cut Down to"),
                        terrains[terrains[terrain].irrigation_result
-                               ].terrain_name
+                               ].name
                        ," (I)", time , PL_("turn", "turns", time));
          pOrder_Irrigation_Button->theme = pTheme->OCutDownForest_Icon;
          break;
@@ -1036,7 +1036,7 @@ void update_menus(void)
          my_snprintf(cBuf, sizeof(cBuf),"%s %s%s %d %s",
                        _("Irrigate to"),
                        terrains[terrains[terrain].irrigation_result
-                               ].terrain_name
+                               ].name
                        ," (I)", time , PL_("turn", "turns", time));
          pOrder_Irrigation_Button->theme = pTheme->OIrrigation_Icon;
          break;
@@ -1062,7 +1062,7 @@ void update_menus(void)
          my_snprintf(cBuf, sizeof(cBuf),"%s %s%s %d %s",
                        _("Irrigate to"),
                        terrains[terrains[terrain].mining_result
-                               ].terrain_name
+                               ].name
                        ," (M)", time , PL_("turn", "turns", time));
          pOrder_Mine_Button->theme = pTheme->OIrrigation_Icon;
          break;
@@ -1094,7 +1094,7 @@ void update_menus(void)
        time = map_transform_time(pUnit->x, pUnit->y);
        my_snprintf(cBuf, sizeof(cBuf),"%s %s%s %d %s",
          _("Transform to"),
-         terrains[terrains[terrain].transform_result].terrain_name,
+         terrains[terrains[terrain].transform_result].name,
                        " (M)", time , 
                        PL_("turn", "turns", time));
        copy_chars_to_string16(pOrder_Transform_Button->string16, cBuf);
Index: client/gui-win32/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/helpdlg.c,v
retrieving revision 1.38
diff -p -u -r1.38 helpdlg.c
--- client/gui-win32/helpdlg.c  20 Jul 2005 02:04:31 -0000      1.38
+++ client/gui-win32/helpdlg.c  31 Jul 2005 18:07:43 -0000
@@ -625,7 +625,7 @@ static void help_update_terrain(const st
       }
     } else if (pterrain->irrigation_result != T_NONE) {
       sprintf(buf, "%s / %d",
-             pterrain->irrigation_result->terrain_name,
+             pterrain->irrigation_result->name,
              pterrain->irrigation_time);
     }
     SetWindowText(help_tlabel[2][4], buf);
@@ -639,14 +639,14 @@ static void help_update_terrain(const st
       }
     } else if (pterrain->mining_result != T_NONE) {
       sprintf(buf, "%s / %d",
-             pterrain->mining_result->terrain_name,
+             pterrain->mining_result->name,
              pterrain->mining_time);
     }
     SetWindowText(help_tlabel[3][1], buf);
 
     if (pterrain->transform_result != T_NONE) {
       sprintf(buf, "%s / %d",
-             pterrain->transform_result->terrain_name,
+             pterrain->transform_result->name,
              pterrain->transform_time);
     } else {
       strcpy(buf, "n/a");
Index: client/gui-xaw/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/helpdlg.c,v
retrieving revision 1.64
diff -p -u -r1.64 helpdlg.c
--- client/gui-xaw/helpdlg.c    28 Jul 2005 18:03:59 -0000      1.64
+++ client/gui-xaw/helpdlg.c    31 Jul 2005 18:07:43 -0000
@@ -1050,7 +1050,7 @@ static void help_update_terrain(const st
       }
     } else if (pterrain->irrigation_result != T_NONE) {
       sprintf(buf, "%s / %d",
-             pterrain->irrigation_result->terrain_name,
+             pterrain->irrigation_result->name,
              pterrain->irrigation_time);
     }
     xaw_set_label(help_terrain_irrigation_result_time_data, buf);
@@ -1064,14 +1064,14 @@ static void help_update_terrain(const st
       }
     } else if (pterrain->mining_result != T_NONE) {
       sprintf(buf, "%s / %d",
-             pterrain->mining_result->terrain_name,
+             pterrain->mining_result->name,
              pterrain->mining_time);
     }
     xaw_set_label (help_terrain_mining_result_time_data, buf);
 
     if (pterrain->transform_result != T_NONE) {
       sprintf(buf, "%s / %d",
-             pterrain->transform_result->terrain_name,
+             pterrain->transform_result->name,
              pterrain->transform_time);
     } else {
       strcpy(buf, _("n/a"));
Index: client/gui-xaw/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/menu.c,v
retrieving revision 1.83
diff -p -u -r1.83 menu.c
--- client/gui-xaw/menu.c       28 Jul 2005 18:03:59 -0000      1.83
+++ client/gui-xaw/menu.c       31 Jul 2005 18:07:43 -0000
@@ -447,7 +447,7 @@ void update_menus(void)
          && (tinfo->irrigation_result->index != ttype)) {
        menu_entry_rename(MENU_ORDER, MENU_ORDER_IRRIGATE,
                          TEXT_ORDER_IRRIGATE_CHANGE_TO,
-                         tinfo->irrigation_result->terrain_name);
+                         tinfo->irrigation_result->name);
       }
       else if (tile_has_special(punit->tile, S_IRRIGATION) &&
               player_knows_techs_with_flag(game.player_ptr, TF_FARMLAND)) {
@@ -462,7 +462,7 @@ void update_menus(void)
          && (tinfo->mining_result->index != ttype)) {
        menu_entry_rename(MENU_ORDER, MENU_ORDER_MINE,
                          TEXT_ORDER_MINE_CHANGE_TO,
-                         tinfo->mining_result->terrain_name);
+                         tinfo->mining_result->name);
       } else {
        menu_entry_rename(MENU_ORDER, MENU_ORDER_MINE,
                          TEXT_ORDER_MINE_MINE, NULL);
@@ -472,7 +472,7 @@ void update_menus(void)
          && (tinfo->transform_result->index != ttype)) {
        menu_entry_rename(MENU_ORDER, MENU_ORDER_TRANSFORM,
                          TEXT_ORDER_TRANSFORM_TRANSFORM_TO,
-                         tinfo->transform_result->terrain_name);
+                         tinfo->transform_result->name);
       } else {
        menu_entry_rename(MENU_ORDER, MENU_ORDER_TRANSFORM,
                          TEXT_ORDER_TRANSFORM_TERRAIN, NULL);
Index: common/combat.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/combat.c,v
retrieving revision 1.60
diff -p -u -r1.60 combat.c
--- common/combat.c     22 Jul 2005 16:18:05 -0000      1.60
+++ common/combat.c     31 Jul 2005 18:07:43 -0000
@@ -602,7 +602,7 @@ struct unit *get_defender(const struct u
             " units) on %s at (%d,%d). ", unit_owner(attacker)->name,
             unit_type(attacker)->name, unit_owner(punit)->name,
             unit_type(punit)->name, unit_list_size(ptile->units), 
-            get_terrain_name(ptile->terrain), ptile->x, ptile->y);
+            get_name(ptile->terrain), ptile->x, ptile->y);
   }
 
   return bestdef;
Index: common/game.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.c,v
retrieving revision 1.232
diff -p -u -r1.232 game.c
--- common/game.c       24 Jul 2005 17:01:35 -0000      1.232
+++ common/game.c       31 Jul 2005 18:07:43 -0000
@@ -575,8 +575,8 @@ void translate_data_names(void)
   } impr_type_iterate_end;
 
   terrain_type_iterate(tthis) {
-    tthis->terrain_name = ((strcmp(tthis->terrain_name_orig, "") != 0)
-                          ? Q_(tthis->terrain_name_orig) : "");
+    tthis->name = ((strcmp(tthis->name_orig, "") != 0)
+                          ? Q_(tthis->name_orig) : "");
 
     tthis->special[0].name = ((strcmp(tthis->special[0].name_orig, "") != 0)
                              ? Q_(tthis->special[0].name_orig) : "");
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.146
diff -p -u -r1.146 packets.def
--- common/packets.def  26 Jul 2005 16:35:59 -0000      1.146
+++ common/packets.def  31 Jul 2005 18:07:44 -0000
@@ -1218,7 +1218,7 @@ PACKET_RULESET_TERRAIN=105;sc,lsend
 
   BV_TERRAIN_FLAGS flags;
 
-  STRING terrain_name[MAX_LEN_NAME];
+  STRING name_orig[MAX_LEN_NAME];
   STRING graphic_str[MAX_LEN_NAME];
   STRING graphic_alt[MAX_LEN_NAME];
 
Index: common/requirements.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/requirements.c,v
retrieving revision 1.31
diff -p -u -r1.31 requirements.c
--- common/requirements.c       22 Jul 2005 16:18:06 -0000      1.31
+++ common/requirements.c       31 Jul 2005 18:07:44 -0000
@@ -971,7 +971,7 @@ char *get_req_source_text(const struct r
     mystrlcat(buf, get_special_name(psource->value.special), bufsz);
     break;
   case REQ_TERRAIN:
-    mystrlcat(buf, get_terrain_name(psource->value.terrain), bufsz);
+    mystrlcat(buf, get_name(psource->value.terrain), bufsz);
     break;
   case REQ_NATION:
     mystrlcat(buf, get_nation_name(psource->value.nation), bufsz);
Index: common/terrain.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/terrain.c,v
retrieving revision 1.27
diff -p -u -r1.27 terrain.c
--- common/terrain.c    19 Jul 2005 06:58:45 -0000      1.27
+++ common/terrain.c    31 Jul 2005 18:07:44 -0000
@@ -77,7 +77,7 @@ struct terrain *get_terrain(Terrain_type
 struct terrain *get_terrain_by_name(const char *name)
 {
   terrain_type_iterate(pterrain) {
-    if (0 == strcmp(pterrain->terrain_name, name)) {
+    if (0 == strcmp(pterrain->name, name)) {
       return pterrain;
     }
   } terrain_type_iterate_end;
@@ -88,10 +88,10 @@ struct terrain *get_terrain_by_name(cons
 /****************************************************************************
   Return the name of the terrain.
 ****************************************************************************/
-const char *get_terrain_name(const struct terrain *pterrain)
+const char *get_name(const struct terrain *pterrain)
 {
   SANITY_CHECK_TERRAIN(pterrain);
-  return pterrain->terrain_name;
+  return pterrain->name;
 }
 
 /****************************************************************************
Index: common/terrain.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/terrain.h,v
retrieving revision 1.40
diff -p -u -r1.40 terrain.h
--- common/terrain.h    16 Jul 2005 03:35:55 -0000      1.40
+++ common/terrain.h    31 Jul 2005 18:07:44 -0000
@@ -100,8 +100,8 @@ enum mapgen_terrain_property {
  */
 struct terrain {
   int index;
-  const char *terrain_name; /* Translated string - doesn't need freeing. */
-  char terrain_name_orig[MAX_LEN_NAME];        /* untranslated copy */
+  const char *name; /* Translated string - doesn't need freeing. */
+  char name_orig[MAX_LEN_NAME];        /* untranslated copy */
   char graphic_str[MAX_LEN_NAME];
   char graphic_alt[MAX_LEN_NAME];
 
@@ -166,7 +166,7 @@ void terrains_init(void);
 /* General terrain accessor functions. */
 struct terrain *get_terrain(Terrain_type_id type);
 struct terrain *get_terrain_by_name(const char *name);
-const char *get_terrain_name(const struct terrain *pterrain);
+const char *get_name(const struct terrain *pterrain);
 enum terrain_flag_id terrain_flag_from_str(const char *s);
 #define terrain_has_flag(terr, flag) BV_ISSET((terr)->flags, flag)
 struct terrain *get_flag_terrain(enum terrain_flag_id flag);
Index: common/tile.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/tile.c,v
retrieving revision 1.9
diff -p -u -r1.9 tile.c
--- common/tile.c       14 Jul 2005 19:25:45 -0000      1.9
+++ common/tile.c       31 Jul 2005 18:07:44 -0000
@@ -378,7 +378,7 @@ const char *tile_get_info_text(const str
   static char s[256];
   bool first;
 
-  sz_strlcpy(s, ptile->terrain->terrain_name);
+  sz_strlcpy(s, ptile->terrain->name);
   if (tile_has_special(ptile, S_RIVER)) {
     sz_strlcat(s, "/");
     sz_strlcat(s, get_special_name(S_RIVER));
Index: manual/civmanual.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/manual/civmanual.c,v
retrieving revision 1.14
diff -p -u -r1.14 civmanual.c
--- manual/civmanual.c  14 Jul 2005 19:25:46 -0000      1.14
+++ manual/civmanual.c  31 Jul 2005 18:07:44 -0000
@@ -235,7 +235,7 @@ static bool manual_command(void)
 
        fprintf(doc, "<tr><td>%s%s%s %s</td>", IMAGE_BEGIN,
                pterrain->graphic_str,
-               IMAGE_END, get_terrain_name(pterrain));
+               IMAGE_END, get_name(pterrain));
        fprintf(doc, "<td>%d / %d / %d</td>",
                pterrain->output[O_FOOD], pterrain->output[O_SHIELD],
                pterrain->output[O_TRADE]);
@@ -255,7 +255,7 @@ static bool manual_command(void)
                pterrain->defense_bonus, pterrain->road_trade_incr,
                pterrain->irrigation_food_incr, pterrain->mining_shield_incr);
        fprintf(doc, "<td>%s</td></tr>\n\n",
-               get_terrain_name(pterrain->transform_result));
+               get_name(pterrain->transform_result));
       } terrain_type_iterate_end;
       fprintf(doc, _("</table><br><br><br><table border=1>"));
       fprintf(doc, _("<caption>Time to perform action</caption>"));
@@ -266,9 +266,9 @@ static bool manual_command(void)
       fprintf(doc, _("<th>Clean pollution</th><th>Clean fallout</th>\n"));
       fprintf(doc, _("<th>Transform</th></tr>\n"));
       terrain_type_iterate(pterrain) {
-       const char *name = get_terrain_name(pterrain);
+       const char *name = get_name(pterrain);
 
-       if (pterrain->terrain_name[0] == '\0') {
+       if (pterrain->name[0] == '\0') {
          /* Must be a disabled piece of terrain */
          continue;
        }
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.327
diff -p -u -r1.327 cityturn.c
--- server/cityturn.c   30 Jul 2005 05:10:02 -0000      1.327
+++ server/cityturn.c   31 Jul 2005 18:07:45 -0000
@@ -768,7 +768,7 @@ static bool worklist_change_build_target
                                 "%s terrain is required.  Postponing..."),
                               pcity->name,
                               get_impr_name_ex(pcity, target),
-                              get_terrain_name(preq->source.value.terrain));
+                              get_name(preq->source.value.terrain));
              script_signal_emit("building_cant_be_built", 3,
                                 API_TYPE_BUILDING_TYPE, building,
                                 API_TYPE_CITY, pcity,
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.277
diff -p -u -r1.277 ruleset.c
--- server/ruleset.c    24 Jul 2005 17:01:36 -0000      1.277
+++ server/ruleset.c    31 Jul 2005 18:07:45 -0000
@@ -80,7 +80,7 @@ static void load_tech_names(struct secti
 static void load_unit_names(struct section_file *file);
 static void load_building_names(struct section_file *file);
 static void load_government_names(struct section_file *file);
-static void load_terrain_names(struct section_file *file);
+static void load_names(struct section_file *file);
 static void load_citystyle_names(struct section_file *file);
 static void load_nation_names(struct section_file *file);
 static struct city_name* load_city_name_list(struct section_file *file,
@@ -660,14 +660,14 @@ static struct terrain *lookup_terrain(ch
   }
 
   terrain_type_iterate(pterrain) {
-    if (0 == strcmp(name, pterrain->terrain_name)) {
+    if (0 == strcmp(name, pterrain->name)) {
       return pterrain;
     }
   } terrain_type_iterate_end;
 
   /* TRANS: message for an obscure ruleset error. */
   freelog(LOG_ERROR, _("Unknown terrain %s in entry %s."),
-         name, tthis->terrain_name);
+         name, tthis->name);
   return T_NONE;
 }
 
@@ -1390,7 +1390,7 @@ static void load_ruleset_buildings(struc
 /**************************************************************************
   ...  
 **************************************************************************/
-static void load_terrain_names(struct section_file *file)
+static void load_names(struct section_file *file)
 {
   int nval;
   char **sec;
@@ -1410,14 +1410,14 @@ static void load_terrain_names(struct se
   game.control.terrain_count = nval;
 
   terrain_type_iterate(pterrain) {
-    char *name = secfile_lookup_str(file, "%s.terrain_name",
+    char *name = secfile_lookup_str(file, "%s.name",
                                    sec[pterrain->index]);
 
-    name_strlcpy(pterrain->terrain_name_orig, name);
-    if (0 == strcmp(pterrain->terrain_name_orig, "unused")) {
-      pterrain->terrain_name_orig[0] = '\0';
+    name_strlcpy(pterrain->name_orig, name);
+    if (0 == strcmp(pterrain->name_orig, "unused")) {
+      pterrain->name_orig[0] = '\0';
     }
-    pterrain->terrain_name = pterrain->terrain_name_orig;
+    pterrain->name = pterrain->name_orig;
   } terrain_type_iterate_end;
 
   free(sec);
@@ -1514,7 +1514,7 @@ static void load_ruleset_terrain(struct 
        freelog(LOG_FATAL,
                /* TRANS: message for an obscure ruleset error. */
                _("Terrains %s and %s have the same identifier."),
-               pterrain->terrain_name, get_terrain(j)->terrain_name);
+               pterrain->name, get_terrain(j)->name);
        exit(EXIT_FAILURE);
       }
     }
@@ -1617,7 +1617,7 @@ static void load_ruleset_terrain(struct 
       if (flag == TER_LAST) {
        /* TRANS: message for an obscure ruleset error. */
        freelog(LOG_FATAL, _("Terrain %s has unknown flag %s"),
-               pterrain->terrain_name, sval);
+               pterrain->name, sval);
        exit(EXIT_FAILURE);
       } else {
        BV_SET(pterrain->flags, flag);
@@ -1993,12 +1993,12 @@ static struct city_name* load_city_name_
            terrain_type_iterate(pterrain) {
               /*
                * Note that at this time (before a call to
-               * translate_data_names) the terrain_name fields contains an
+               * translate_data_names) the name fields contains an
                * untranslated string.  Note that name of T_RIVER_UNUSED is "".
                * However this is not a problem because we take care of rivers
                * separately.
                */
-             if (mystrcasecmp(name, pterrain->terrain_name) == 0) {
+             if (mystrcasecmp(name, pterrain->name) == 0) {
                city_names[j].terrain[pterrain->index] = setting;
                handled = TRUE;
                break;
@@ -2789,7 +2789,7 @@ static void send_ruleset_terrain(struct 
 
     packet.id = i;
 
-    sz_strlcpy(packet.terrain_name, pterrain->terrain_name_orig);
+    sz_strlcpy(packet.name_orig, pterrain->name_orig);
     sz_strlcpy(packet.graphic_str, pterrain->graphic_str);
     sz_strlcpy(packet.graphic_alt, pterrain->graphic_alt);
 
@@ -3080,7 +3080,7 @@ void load_rulesets(void)
   load_unit_names(&unitfile);
 
   openload_ruleset_file(&terrfile, "terrain");
-  load_terrain_names(&terrfile);
+  load_names(&terrfile);
 
   openload_ruleset_file(&cityfile, "cities");
   load_citystyle_names(&cityfile);
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.372
diff -p -u -r1.372 unittools.c
--- server/unittools.c  22 Jul 2005 16:18:08 -0000      1.372
+++ server/unittools.c  31 Jul 2005 18:07:46 -0000
@@ -2222,7 +2222,7 @@ bool do_paradrop(struct unit *punit, str
   if (!is_native_terrain(punit, map_get_player_tile(ptile, pplayer)->terrain)) 
{
     notify_player_ex(pplayer, ptile, E_NOEVENT,
                      _("This unit cannot paradrop into %s."),
-                       get_terrain_name(map_get_player_tile(ptile, 
pplayer)->terrain));
+                       get_name(map_get_player_tile(ptile, pplayer)->terrain));
     return FALSE;
   }
 
@@ -2256,7 +2256,7 @@ bool do_paradrop(struct unit *punit, str
     notify_player_ex(pplayer, ptile, E_UNIT_LOST,
                      _("Your %s paradropped into the %s "
                        "and was lost."),
-                     unit_type(punit)->name, get_terrain_name(ptile->terrain));
+                     unit_type(punit)->name, get_name(ptile->terrain));
     server_remove_unit(punit);
     return TRUE;
   }
Index: server/generator/mapgen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/generator/mapgen.c,v
retrieving revision 1.29
diff -p -u -r1.29 mapgen.c
--- server/generator/mapgen.c   14 Jul 2005 19:25:47 -0000      1.29
+++ server/generator/mapgen.c   31 Jul 2005 18:07:46 -0000
@@ -1109,7 +1109,7 @@ static void print_mapgen_map(void)
 
   terrain_type_iterate(pterrain) {
     freelog(loglevel, "%20s : %4d %d%%  ",
-           get_terrain_name(pterrain), terrain_count[pterrain->index],
+           get_name(pterrain), terrain_count[pterrain->index],
            (terrain_count[pterrain->index] * 100 + 50) / total);
   } terrain_type_iterate_end;
 }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13578) rename terrain_name as name, Jason Short <=