[Freeciv-Dev] (PR#13424) rename "struct tile_type" as "struct terrain"
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13424 >
This patch renames the tile_type struct in terrain.h as a terrain
struct. This is, well, more logical - even though improvement.h has
"struct impr_type" and tech.h has "struct advance", at least unittype.h
has "struct unit_type" and tile.h has "struct tile" and nation.h has
"struct nation" and team.h has "struct team".
It is simple search-and-replace except for cm.c, which has a "struct
tile_type_vector" and "cm_tile_type" which looks like it is actually
named correctly.
Also I renamed
get_tile_type() -> get_terrain()
tile_types_free() -> terrains_free()
tile_types[] -> terrains[]
which is also search-and-replace.
-jason
Index: ai/aisettler.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aisettler.c,v
retrieving revision 1.23
diff -p -u -r1.23 aisettler.c
--- ai/aisettler.c 4 Jul 2005 18:42:26 -0000 1.23
+++ ai/aisettler.c 8 Jul 2005 20:46:53 -0000
@@ -296,7 +296,7 @@ static int defense_bonus(struct cityresu
{
/* Defense modification (as tie breaker mostly) */
int defense_bonus =
- 10 + get_tile_type(tile_get_terrain(result->tile))->defense_bonus / 10;
+ 10 + get_terrain(tile_get_terrain(result->tile))->defense_bonus / 10;
if (tile_has_special(result->tile, S_RIVER)) {
defense_bonus +=
(defense_bonus * terrain_control.river_defense_bonus) / 100;
Index: ai/aitools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aitools.c,v
retrieving revision 1.152
diff -p -u -r1.152 aitools.c
--- ai/aitools.c 4 Jul 2005 18:42:26 -0000 1.152
+++ ai/aitools.c 8 Jul 2005 20:46:53 -0000
@@ -478,7 +478,7 @@ static double chance_killed_at(const str
double p = is_ocean(ptile->terrain)? 0.05: 0.15;
/* If we are on defensive terrain, we are more likely to survive */
- db = 10 + get_tile_type(ptile->terrain)->defense_bonus / 10;
+ db = 10 + get_terrain(ptile->terrain)->defense_bonus / 10;
if (tile_has_special(ptile, S_RIVER)) {
db += (db * terrain_control.river_defense_bonus) / 100;
}
Index: ai/aiunit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v
retrieving revision 1.362
diff -p -u -r1.362 aiunit.c
--- ai/aiunit.c 4 Jul 2005 18:42:26 -0000 1.362
+++ ai/aiunit.c 8 Jul 2005 20:46:54 -0000
@@ -799,10 +799,10 @@ static bool find_beachhead(struct unit *
if (ok > 0) {
/* accessible beachhead with zoc-ok water tile nearby */
- ok = 10 + get_tile_type(t)->defense_bonus / 10;
+ ok = 10 + get_terrain(t)->defense_bonus / 10;
if (tile_has_special(tile1, S_RIVER))
ok += (ok * terrain_control.river_defense_bonus) / 100;
- if (get_tile_type(t)->movement_cost * SINGLE_MOVE <
+ if (get_terrain(t)->movement_cost * SINGLE_MOVE <
unit_move_rate(punit))
ok *= 8;
ok += (6 * THRESHOLD - WARMAP_SEACOST(tile1));
Index: client/control.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/control.c,v
retrieving revision 1.180
diff -p -u -r1.180 control.c
--- client/control.c 4 Jul 2005 17:48:36 -0000 1.180
+++ client/control.c 8 Jul 2005 20:46:54 -0000
@@ -697,7 +697,7 @@ bool can_unit_do_connect(struct unit *pu
{
struct player *pplayer = unit_owner(punit);
Terrain_type_id terrain = tile_get_terrain(punit->tile);
- struct tile_type *ttype = get_tile_type(terrain);
+ struct terrain *ttype = get_terrain(terrain);
/* HACK: This code duplicates that in
* can_unit_do_activity_targeted_at(). The general logic here is that
Index: client/goto.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/goto.c,v
retrieving revision 1.87
diff -p -u -r1.87 goto.c
--- client/goto.c 25 Jun 2005 08:05:27 -0000 1.87
+++ client/goto.c 8 Jul 2005 20:46:54 -0000
@@ -390,7 +390,7 @@ static enum tile_behavior get_TB_caravan
static int get_activity_time(const struct tile *ptile,
struct player *pplayer)
{
- struct tile_type *ttype = get_tile_type(ptile->terrain);
+ struct terrain *ttype = get_terrain(ptile->terrain);
int activity_mc = 0;
assert(hover_state == HOVER_CONNECT);
Index: client/helpdata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/helpdata.c,v
retrieving revision 1.117
diff -p -u -r1.117 helpdata.c
--- client/helpdata.c 28 Jun 2005 07:29:13 -0000 1.117
+++ client/helpdata.c 8 Jul 2005 20:46:55 -0000
@@ -122,24 +122,24 @@ static void insert_generated_table(const
strcat(outbuf, "---------------------------------------------------"
"------------\n");
for (i = T_FIRST; i < T_COUNT; i++) {
- if (*(tile_types[i].terrain_name) != '\0') {
+ if (*(terrains[i].terrain_name) != '\0') {
outbuf = strchr(outbuf, '\0');
sprintf(outbuf,
"%-10s %3d %3d %-10s %3d %-10s %3d %-10s\n",
- tile_types[i].terrain_name,
- tile_types[i].road_time,
- tile_types[i].irrigation_time,
- ((tile_types[i].irrigation_result == i
- || tile_types[i].irrigation_result == T_NONE) ? ""
- : tile_types[tile_types[i].irrigation_result].terrain_name),
- tile_types[i].mining_time,
- ((tile_types[i].mining_result == i
- || tile_types[i].mining_result == T_NONE) ? ""
- : tile_types[tile_types[i].mining_result].terrain_name),
- tile_types[i].transform_time,
- ((tile_types[i].transform_result == i
- || tile_types[i].transform_result == T_NONE) ? ""
- : tile_types[tile_types[i].transform_result].terrain_name));
+ terrains[i].terrain_name,
+ terrains[i].road_time,
+ terrains[i].irrigation_time,
+ ((terrains[i].irrigation_result == i
+ || terrains[i].irrigation_result == T_NONE) ? ""
+ : terrains[terrains[i].irrigation_result].terrain_name),
+ terrains[i].mining_time,
+ ((terrains[i].mining_result == i
+ || terrains[i].mining_result == T_NONE) ? ""
+ : terrains[terrains[i].mining_result].terrain_name),
+ terrains[i].transform_time,
+ ((terrains[i].transform_result == i
+ || terrains[i].transform_result == T_NONE) ? ""
+ : terrains[terrains[i].transform_result].terrain_name));
}
}
strcat(outbuf, "\n");
@@ -388,10 +388,10 @@ void boot_help_texts(void)
} tech_type_iterate_end;
} else if (current_type == HELP_TERRAIN) {
for (i = T_FIRST; i < T_COUNT; i++) {
- if (*(tile_types[i].terrain_name) != '\0') {
+ if (*(terrains[i].terrain_name) != '\0') {
pitem = new_help_item(current_type);
my_snprintf(name, sizeof(name), " %s",
- tile_types[i].terrain_name);
+ terrains[i].terrain_name);
pitem->topic = mystrdup(name);
pitem->text = mystrdup("");
help_list_append(category_nodes, pitem);
@@ -1186,7 +1186,7 @@ void helptext_tech(char *buf, int i, con
*****************************************************************/
void helptext_terrain(char *buf, int i, const char *user_text)
{
- struct tile_type *pt;
+ struct terrain *pt;
buf[0] = '\0';
@@ -1194,7 +1194,7 @@ void helptext_terrain(char *buf, int i,
freelog(LOG_ERROR, "Unknown terrain %d.", i);
return;
}
- pt = &tile_types[i];
+ pt = &terrains[i];
if (terrain_has_flag(i, TER_NO_POLLUTION)) {
sprintf(buf + strlen(buf),
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.527
diff -p -u -r1.527 packhand.c
--- client/packhand.c 4 Jul 2005 17:48:36 -0000 1.527
+++ client/packhand.c 8 Jul 2005 20:46:55 -0000
@@ -2273,7 +2273,7 @@ void handle_ruleset_government_ruler_tit
**************************************************************************/
void handle_ruleset_terrain(struct packet_ruleset_terrain *p)
{
- struct tile_type *t;
+ struct terrain *t;
if (p->id < T_FIRST || p->id >= T_COUNT) {
freelog(LOG_ERROR,
@@ -2281,7 +2281,7 @@ void handle_ruleset_terrain(struct packe
p->id);
return;
}
- t = &(tile_types[p->id]);
+ t = &(terrains[p->id]);
sz_strlcpy(t->terrain_name_orig, p->terrain_name);
t->terrain_name = t->terrain_name_orig;
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.312
diff -p -u -r1.312 tilespec.c
--- client/tilespec.c 4 Jul 2005 17:48:36 -0000 1.312
+++ client/tilespec.c 8 Jul 2005 20:46:56 -0000
@@ -2392,7 +2392,7 @@ void tileset_setup_tech_type(struct tile
***********************************************************************/
void tileset_setup_tile_type(struct tileset *t, Terrain_type_id terrain)
{
- struct tile_type *tt = get_tile_type(terrain);
+ struct terrain *tt = get_terrain(terrain);
struct terrain_drawing_data *draw;
char buffer1[MAX_LEN_NAME + 20];
int i, l;
Index: client/gui-ftwl/gui_text.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-ftwl/gui_text.c,v
retrieving revision 1.12
diff -p -u -r1.12 gui_text.c
--- client/gui-ftwl/gui_text.c 8 May 2005 06:37:49 -0000 1.12
+++ client/gui-ftwl/gui_text.c 8 Jul 2005 20:46:56 -0000
@@ -293,23 +293,23 @@ const char *mapview_get_unit_action_tool
} else {
#if 0
ttype = punit->tile->terrain;
- tinfo = get_tile_type(ttype);
+ tinfo = get_terrain(ttype);
if ((tinfo->irrigation_result != T_LAST)
&& (tinfo->irrigation_result != ttype)) {
my_snprintf(irrtext, sizeof(irrtext), irrfmt,
- (get_tile_type(tinfo->irrigation_result))->terrain_name);
+ (get_terrain(tinfo->irrigation_result))->terrain_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_tile_type(tinfo->mining_result))->terrain_name);
+ (get_terrain(tinfo->mining_result))->terrain_name);
}
if ((tinfo->transform_result != T_LAST)
&& (tinfo->transform_result != ttype)) {
my_snprintf(transtext, sizeof(transtext), transfmt,
- (get_tile_type(tinfo->transform_result))->terrain_name);
+ (get_terrain(tinfo->transform_result))->terrain_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.53
diff -p -u -r1.53 helpdlg.c
--- client/gui-gtk-2.0/helpdlg.c 4 Jul 2005 18:42:27 -0000 1.53
+++ client/gui-gtk-2.0/helpdlg.c 8 Jul 2005 20:46:56 -0000
@@ -1031,89 +1031,89 @@ static void help_update_terrain(const st
if (i < T_COUNT) {
sprintf(buf, "%d/%d.%d",
- tile_types[i].movement_cost,
- (int)((tile_types[i].defense_bonus + 100) / 100),
- (tile_types[i].defense_bonus + 100) % 100 / 10);
+ terrains[i].movement_cost,
+ (int)((terrains[i].defense_bonus + 100) / 100),
+ (terrains[i].defense_bonus + 100) % 100 / 10);
gtk_label_set_text(GTK_LABEL(help_tlabel[0][1]), buf);
sprintf(buf, "%d/%d/%d",
- tile_types[i].output[O_FOOD],
- tile_types[i].output[O_SHIELD],
- tile_types[i].output[O_TRADE]);
+ terrains[i].output[O_FOOD],
+ terrains[i].output[O_SHIELD],
+ terrains[i].output[O_TRADE]);
gtk_label_set_text(GTK_LABEL(help_tlabel[0][4]), buf);
- if (*(tile_types[i].special[0].name)) {
+ if (*(terrains[i].special[0].name)) {
sprintf(buf, _("%s F/R/T:"),
- tile_types[i].special[0].name);
+ terrains[i].special[0].name);
gtk_label_set_text(GTK_LABEL(help_tlabel[1][0]), buf);
sprintf(buf, "%d/%d/%d",
- tile_types[i].special[0].output[O_FOOD],
- tile_types[i].special[0].output[O_SHIELD],
- tile_types[i].special[0].output[O_TRADE]);
+ terrains[i].special[0].output[O_FOOD],
+ terrains[i].special[0].output[O_SHIELD],
+ terrains[i].special[0].output[O_TRADE]);
gtk_label_set_text(GTK_LABEL(help_tlabel[1][1]), buf);
} else {
gtk_label_set_text(GTK_LABEL(help_tlabel[1][0]), "");
gtk_label_set_text(GTK_LABEL(help_tlabel[1][1]), "");
}
- if (*(tile_types[i].special[1].name)) {
+ if (*(terrains[i].special[1].name)) {
sprintf(buf, _("%s F/R/T:"),
- tile_types[i].special[1].name);
+ terrains[i].special[1].name);
gtk_label_set_text(GTK_LABEL(help_tlabel[1][3]), buf);
sprintf(buf, "%d/%d/%d",
- tile_types[i].special[1].output[O_FOOD],
- tile_types[i].special[1].output[O_SHIELD],
- tile_types[i].special[1].output[O_TRADE]);
+ terrains[i].special[1].output[O_FOOD],
+ terrains[i].special[1].output[O_SHIELD],
+ terrains[i].special[1].output[O_TRADE]);
gtk_label_set_text(GTK_LABEL(help_tlabel[1][4]), buf);
} else {
gtk_label_set_text(GTK_LABEL(help_tlabel[1][3]), "");
gtk_label_set_text(GTK_LABEL(help_tlabel[1][4]), "");
}
- if (tile_types[i].road_trade_incr > 0) {
+ if (terrains[i].road_trade_incr > 0) {
sprintf(buf, _("+%d Trade / %d"),
- tile_types[i].road_trade_incr,
- tile_types[i].road_time);
- } else if (tile_types[i].road_time > 0) {
+ terrains[i].road_trade_incr,
+ terrains[i].road_time);
+ } else if (terrains[i].road_time > 0) {
sprintf(buf, _("no extra / %d"),
- tile_types[i].road_time);
+ terrains[i].road_time);
} else {
strcpy(buf, _("n/a"));
}
gtk_label_set_text(GTK_LABEL(help_tlabel[2][1]), buf);
strcpy(buf, _("n/a"));
- if (tile_types[i].irrigation_result == i) {
- if (tile_types[i].irrigation_food_incr > 0) {
+ if (terrains[i].irrigation_result == i) {
+ if (terrains[i].irrigation_food_incr > 0) {
sprintf(buf, _("+%d Food / %d"),
- tile_types[i].irrigation_food_incr,
- tile_types[i].irrigation_time);
+ terrains[i].irrigation_food_incr,
+ terrains[i].irrigation_time);
}
- } else if (tile_types[i].irrigation_result != T_NONE) {
+ } else if (terrains[i].irrigation_result != T_NONE) {
sprintf(buf, "%s / %d",
- tile_types[tile_types[i].irrigation_result].terrain_name,
- tile_types[i].irrigation_time);
+ terrains[terrains[i].irrigation_result].terrain_name,
+ terrains[i].irrigation_time);
}
gtk_label_set_text(GTK_LABEL(help_tlabel[2][4]), buf);
strcpy(buf, _("n/a"));
- if (tile_types[i].mining_result == i) {
- if (tile_types[i].mining_shield_incr > 0) {
+ if (terrains[i].mining_result == i) {
+ if (terrains[i].mining_shield_incr > 0) {
sprintf(buf, _("+%d Res. / %d"),
- tile_types[i].mining_shield_incr,
- tile_types[i].mining_time);
+ terrains[i].mining_shield_incr,
+ terrains[i].mining_time);
}
- } else if (tile_types[i].mining_result != T_NONE) {
+ } else if (terrains[i].mining_result != T_NONE) {
sprintf(buf, "%s / %d",
- tile_types[tile_types[i].mining_result].terrain_name,
- tile_types[i].mining_time);
+ terrains[terrains[i].mining_result].terrain_name,
+ terrains[i].mining_time);
}
gtk_label_set_text(GTK_LABEL(help_tlabel[3][1]), buf);
- if (tile_types[i].transform_result != T_NONE) {
+ if (terrains[i].transform_result != T_NONE) {
sprintf(buf, "%s / %d",
- tile_types[tile_types[i].transform_result].terrain_name,
- tile_types[i].transform_time);
+ terrains[terrains[i].transform_result].terrain_name,
+ terrains[i].transform_time);
} else {
strcpy(buf, "n/a");
}
Index: client/gui-gtk-2.0/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/menu.c,v
retrieving revision 1.79
diff -p -u -r1.79 menu.c
--- client/gui-gtk-2.0/menu.c 25 Jun 2005 07:49:20 -0000 1.79
+++ client/gui-gtk-2.0/menu.c 8 Jul 2005 20:46:57 -0000
@@ -1293,7 +1293,7 @@ void update_menus(void)
char irrtext[128], mintext[128], transtext[128];
const char *roadtext;
Terrain_type_id ttype;
- struct tile_type * tinfo;
+ struct terrain * tinfo;
sz_strlcpy(irrtext, _("Build _Irrigation"));
sz_strlcpy(mintext, _("Build _Mine"));
@@ -1387,7 +1387,7 @@ void update_menus(void)
menus_rename("<main>/_Orders/Build _Road", _("Build _Road"));
ttype = punit->tile->terrain;
- tinfo = get_tile_type(ttype);
+ tinfo = get_terrain(ttype);
if (tinfo->irrigation_result != T_NONE
&& tinfo->irrigation_result != ttype) {
my_snprintf(irrtext, sizeof(irrtext), irrfmt,
Index: client/gui-mui/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/gui_main.c,v
retrieving revision 1.97
diff -p -u -r1.97 gui_main.c
--- client/gui-mui/gui_main.c 5 May 2005 18:32:48 -0000 1.97
+++ client/gui-mui/gui_main.c 8 Jul 2005 20:46:57 -0000
@@ -1241,7 +1241,7 @@ void update_menus(void) /* from menu.c *
static char mintext[64];
static char transtext[64];
Terrain_type_id ttype;
- struct tile_type *tinfo;
+ struct terrain *tinfo;
set(main_menu, MUIA_Window_Menustrip, NULL);
@@ -1295,11 +1295,11 @@ void update_menus(void) /* from menu.c *
}
ttype = map_get_tile(punit->tile)->terrain;
- tinfo = get_tile_type(ttype);
+ tinfo = get_terrain(ttype);
if ((tinfo->irrigation_result != T_NONE)
&& (tinfo->irrigation_result != ttype)) {
my_snprintf(irrtext, sizeof(irrtext), chgfmt,
- (get_tile_type(tinfo->irrigation_result))->terrain_name);
+ (get_terrain(tinfo->irrigation_result))->terrain_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_tile_type(tinfo->mining_result))->terrain_name);
+ (get_terrain(tinfo->mining_result))->terrain_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_tile_type(tinfo->transform_result))->terrain_name);
+ (get_terrain(tinfo->transform_result))->terrain_name);
} else {
sz_strlcpy(transtext, _("Transform Terrain"));
}
Index: client/gui-mui/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/helpdlg.c,v
retrieving revision 1.40
diff -p -u -r1.40 helpdlg.c
--- client/gui-mui/helpdlg.c 5 May 2005 18:32:48 -0000 1.40
+++ client/gui-mui/helpdlg.c 8 Jul 2005 20:46:57 -0000
@@ -852,12 +852,12 @@ static void help_update_terrain(const st
if (i < T_COUNT)
{
- struct tile_type *tile = get_tile_type(i);
+ struct terrain *tile = get_terrain(i);
char buf[256];
Object *o,*g;
- settextf(help_terrain_move_text, _("Movecost: %ld"),
tile_types[i].movement_cost);
- settextf(help_terrain_defense_text, _("Defense: %ld.%ld"),
(tile_types[i].defense_bonus / 10), tile_types[i].defense_bonus % 10);
+ settextf(help_terrain_move_text, _("Movecost: %ld"),
terrains[i].movement_cost);
+ settextf(help_terrain_defense_text, _("Defense: %ld.%ld"),
(terrains[i].defense_bonus / 10), terrains[i].defense_bonus % 10);
DoMethod(help_right_group, MUIM_Group_InitChange);
DoMethod(help_page_group, MUIM_Group_InitChange);
Index: client/gui-sdl/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/dialogs.c,v
retrieving revision 1.63
diff -p -u -r1.63 dialogs.c
--- client/gui-sdl/dialogs.c 28 May 2005 21:24:00 -0000 1.63
+++ client/gui-sdl/dialogs.c 8 Jul 2005 20:46:58 -0000
@@ -802,7 +802,7 @@ static int exit_terrain_info_dialog(stru
const char *sdl_get_tile_defense_info_text(struct tile *pTile)
{
static char buffer[64];
- int bonus = (tile_types[pTile->terrain].defense_bonus - 10) * 10;
+ int bonus = (terrains[pTile->terrain].defense_bonus - 10) * 10;
if((pTile->special & S_RIVER) == S_RIVER) {
bonus += terrain_control.river_defense_bonus;
@@ -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", tile_types[pTile->terrain].terrain_name);
+ my_snprintf(s, sizeof(s), "%s", terrains[pTile->terrain].terrain_name);
if((pTile->special & S_RIVER) == S_RIVER) {
sz_strlcat(s, "/");
sz_strlcat(s, get_special_name(S_RIVER));
@@ -836,7 +836,7 @@ const char *sdl_map_get_tile_info_text(s
first = TRUE;
if ((pTile->special & S_SPECIAL_1) == S_SPECIAL_1) {
first = FALSE;
- cat_snprintf(s, sizeof(s), " (%s",
tile_types[pTile->terrain].special_1_name);
+ cat_snprintf(s, sizeof(s), " (%s",
terrains[pTile->terrain].special_1_name);
}
if ((pTile->special & S_SPECIAL_2) == S_SPECIAL_2) {
if (first) {
@@ -845,7 +845,7 @@ const char *sdl_map_get_tile_info_text(s
} else {
sz_strlcat(s, "/");
}
- sz_strlcat(s, tile_types[pTile->terrain].special_2_name);
+ sz_strlcat(s, terrains[pTile->terrain].special_2_name);
}
if (!first) {
sz_strlcat(s, ")");
Index: client/gui-sdl/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/menu.c,v
retrieving revision 1.30
diff -p -u -r1.30 menu.c
--- client/gui-sdl/menu.c 11 Mar 2005 05:06:11 -0000 1.30
+++ client/gui-sdl/menu.c 8 Jul 2005 20:46:58 -0000
@@ -1027,7 +1027,7 @@ void update_menus(void)
case T_JUNGLE:
my_snprintf(cBuf, sizeof(cBuf),"%s %s%s %d %s",
_("Cut Down to"),
- tile_types[tile_types[terrain].irrigation_result
+ terrains[terrains[terrain].irrigation_result
].terrain_name
," (I)", time , PL_("turn", "turns", time));
pOrder_Irrigation_Button->theme = pTheme->OCutDownForest_Icon;
@@ -1035,7 +1035,7 @@ void update_menus(void)
case T_SWAMP:
my_snprintf(cBuf, sizeof(cBuf),"%s %s%s %d %s",
_("Irrigate to"),
- tile_types[tile_types[terrain].irrigation_result
+ terrains[terrains[terrain].irrigation_result
].terrain_name
," (I)", time , PL_("turn", "turns", time));
pOrder_Irrigation_Button->theme = pTheme->OIrrigation_Icon;
@@ -1061,7 +1061,7 @@ void update_menus(void)
case T_FOREST:
my_snprintf(cBuf, sizeof(cBuf),"%s %s%s %d %s",
_("Irrigate to"),
- tile_types[tile_types[terrain].mining_result
+ terrains[terrains[terrain].mining_result
].terrain_name
," (M)", time , PL_("turn", "turns", time));
pOrder_Mine_Button->theme = pTheme->OIrrigation_Icon;
@@ -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"),
- tile_types[tile_types[terrain].transform_result].terrain_name,
+ terrains[terrains[terrain].transform_result].terrain_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.36
diff -p -u -r1.36 helpdlg.c
--- client/gui-win32/helpdlg.c 4 Jul 2005 18:42:27 -0000 1.36
+++ client/gui-win32/helpdlg.c 8 Jul 2005 20:46:58 -0000
@@ -565,89 +565,89 @@ static void help_update_terrain(const st
if (i < T_COUNT) {
sprintf(buf, "%d/%d.%d",
- tile_types[i].movement_cost,
- (int)((tile_types[i].defense_bonus + 100) / 100),
- (tile_types[i].defense_bonus + 100) % 100 / 10);
+ terrains[i].movement_cost,
+ (int)((terrains[i].defense_bonus + 100) / 100),
+ (terrains[i].defense_bonus + 100) % 100 / 10);
SetWindowText (help_tlabel[0][1], buf);
sprintf(buf, "%d/%d/%d",
- tile_types[i].output[O_FOOD],
- tile_types[i].output[O_SHIELD],
- tile_types[i].output[O_TRADE]);
+ terrains[i].output[O_FOOD],
+ terrains[i].output[O_SHIELD],
+ terrains[i].output[O_TRADE]);
SetWindowText(help_tlabel[0][4], buf);
- if (*(tile_types[i].special[0].name)) {
+ if (*(terrains[i].special[0].name)) {
sprintf(buf, _("%s F/R/T:"),
- tile_types[i].special[0].name);
+ terrains[i].special[0].name);
SetWindowText(help_tlabel[1][0], buf);
sprintf(buf, "%d/%d/%d",
- tile_types[i].special[0].output[O_FOOD],
- tile_types[i].special[0].output[O_SHIELD],
- tile_types[i].special[0].output[O_TRADE]);
+ terrains[i].special[0].output[O_FOOD],
+ terrains[i].special[0].output[O_SHIELD],
+ terrains[i].special[0].output[O_TRADE]);
SetWindowText(help_tlabel[1][1], buf);
} else {
SetWindowText(help_tlabel[1][0], " ");
SetWindowText(help_tlabel[1][1], " ");
}
- if (*(tile_types[i].special[1].name)) {
+ if (*(terrains[i].special[1].name)) {
sprintf(buf, _("%s F/R/T:"),
- tile_types[i].special[1].name);
+ terrains[i].special[1].name);
SetWindowText(help_tlabel[1][3], buf);
sprintf(buf, "%d/%d/%d",
- tile_types[i].special[1].output[O_FOOD],
- tile_types[i].special[1].output[O_SHIELD],
- tile_types[i].special[1].output[O_TRADE]);
+ terrains[i].special[1].output[O_FOOD],
+ terrains[i].special[1].output[O_SHIELD],
+ terrains[i].special[1].output[O_TRADE]);
SetWindowText(help_tlabel[1][4], buf);
} else {
SetWindowText(help_tlabel[1][3], " ");
SetWindowText(help_tlabel[1][4], " ");
}
- if (tile_types[i].road_trade_incr > 0) {
+ if (terrains[i].road_trade_incr > 0) {
sprintf(buf, _("+%d Trade / %d"),
- tile_types[i].road_trade_incr,
- tile_types[i].road_time);
- } else if (tile_types[i].road_time > 0) {
+ terrains[i].road_trade_incr,
+ terrains[i].road_time);
+ } else if (terrains[i].road_time > 0) {
sprintf(buf, _("no extra / %d"),
- tile_types[i].road_time);
+ terrains[i].road_time);
} else {
strcpy(buf, _("n/a"));
}
SetWindowText(help_tlabel[2][1], buf);
strcpy(buf, _("n/a"));
- if (tile_types[i].irrigation_result == i) {
- if (tile_types[i].irrigation_food_incr > 0) {
+ if (terrains[i].irrigation_result == i) {
+ if (terrains[i].irrigation_food_incr > 0) {
sprintf(buf, _("+%d Food / %d"),
- tile_types[i].irrigation_food_incr,
- tile_types[i].irrigation_time);
+ terrains[i].irrigation_food_incr,
+ terrains[i].irrigation_time);
}
- } else if (tile_types[i].irrigation_result != T_NONE) {
+ } else if (terrains[i].irrigation_result != T_NONE) {
sprintf(buf, "%s / %d",
- tile_types[tile_types[i].irrigation_result].terrain_name,
- tile_types[i].irrigation_time);
+ terrains[terrains[i].irrigation_result].terrain_name,
+ terrains[i].irrigation_time);
}
SetWindowText(help_tlabel[2][4], buf);
strcpy(buf, _("n/a"));
- if (tile_types[i].mining_result == i) {
- if (tile_types[i].mining_shield_incr > 0) {
+ if (terrains[i].mining_result == i) {
+ if (terrains[i].mining_shield_incr > 0) {
sprintf(buf, _("+%d Res. / %d"),
- tile_types[i].mining_shield_incr,
- tile_types[i].mining_time);
+ terrains[i].mining_shield_incr,
+ terrains[i].mining_time);
}
- } else if (tile_types[i].mining_result != T_NONE) {
+ } else if (terrains[i].mining_result != T_NONE) {
sprintf(buf, "%s / %d",
- tile_types[tile_types[i].mining_result].terrain_name,
- tile_types[i].mining_time);
+ terrains[terrains[i].mining_result].terrain_name,
+ terrains[i].mining_time);
}
SetWindowText(help_tlabel[3][1], buf);
- if (tile_types[i].transform_result != T_NONE) {
+ if (terrains[i].transform_result != T_NONE) {
sprintf(buf, "%s / %d",
- tile_types[tile_types[i].transform_result].terrain_name,
- tile_types[i].transform_time);
+ terrains[terrains[i].transform_result].terrain_name,
+ terrains[i].transform_time);
} else {
strcpy(buf, "n/a");
}
Index: client/gui-win32/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/menu.c,v
retrieving revision 1.41
diff -p -u -r1.41 menu.c
--- client/gui-win32/menu.c 10 Jun 2005 08:11:01 -0000 1.41
+++ client/gui-win32/menu.c 8 Jul 2005 20:46:59 -0000
@@ -1107,7 +1107,7 @@ update_menus(void)
char irrtext[128], mintext[128], transtext[128];
char *roadtext;
Terrain_type_id ttype;
- struct tile_type *tinfo;
+ struct terrain *tinfo;
sz_strlcpy(irrtext, N_("Build Irrigation") "\tI");
sz_strlcpy(mintext, N_("Build Mine") "\tM");
@@ -1213,7 +1213,7 @@ update_menus(void)
}
ttype = punit->tile->terrain;
- tinfo = get_tile_type(ttype);
+ tinfo = get_terrain(ttype);
if (tinfo->irrigation_result != T_NONE
&& tinfo->irrigation_result != ttype) {
my_snprintf(irrtext, sizeof(irrtext), irrfmt,
Index: client/gui-xaw/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/helpdlg.c,v
retrieving revision 1.62
diff -p -u -r1.62 helpdlg.c
--- client/gui-xaw/helpdlg.c 4 Jul 2005 18:42:27 -0000 1.62
+++ client/gui-xaw/helpdlg.c 8 Jul 2005 20:46:59 -0000
@@ -993,57 +993,57 @@ static void help_update_terrain(const st
if (i < T_COUNT)
{
sprintf (buf, "%d/%d.%d",
- tile_types[i].movement_cost,
- (int)((tile_types[i].defense_bonus + 100) / 100),
- (tile_types[i].defense_bonus + 100) % 100 / 10);
+ terrains[i].movement_cost,
+ (int)((terrains[i].defense_bonus + 100) / 100),
+ (terrains[i].defense_bonus + 100) % 100 / 10);
xaw_set_label (help_terrain_movement_defense_data, buf);
sprintf (buf, "%d/%d/%d",
- tile_types[i].output[O_FOOD],
- tile_types[i].output[O_SHIELD],
- tile_types[i].output[O_TRADE]);
+ terrains[i].output[O_FOOD],
+ terrains[i].output[O_SHIELD],
+ terrains[i].output[O_TRADE]);
xaw_set_label (help_terrain_food_shield_trade_data, buf);
- if (*(tile_types[i].special[0].name))
+ if (*(terrains[i].special[0].name))
{
sprintf (buf, _("%s F/R/T:"),
- tile_types[i].special[0].name);
+ terrains[i].special[0].name);
xaw_set_label (help_terrain_special_1, buf);
sprintf (buf, "%d/%d/%d",
- tile_types[i].special[0].output[O_FOOD],
- tile_types[i].special[0].output[O_SHIELD],
- tile_types[i].special[0].output[O_TRADE]);
+ terrains[i].special[0].output[O_FOOD],
+ terrains[i].special[0].output[O_SHIELD],
+ terrains[i].special[0].output[O_TRADE]);
xaw_set_label (help_terrain_special_1_data, buf);
} else {
xaw_set_label (help_terrain_special_1, "");
xaw_set_label (help_terrain_special_1_data, "");
}
- if (*(tile_types[i].special[1].name))
+ if (*(terrains[i].special[1].name))
{
sprintf (buf, _("%s F/R/T:"),
- tile_types[i].special[1].name);
+ terrains[i].special[1].name);
xaw_set_label (help_terrain_special_2, buf);
sprintf (buf, "%d/%d/%d",
- tile_types[i].special[1].output[O_FOOD],
- tile_types[i].special[1].output[O_SHIELD],
- tile_types[i].special[1].output[O_TRADE]);
+ terrains[i].special[1].output[O_FOOD],
+ terrains[i].special[1].output[O_SHIELD],
+ terrains[i].special[1].output[O_TRADE]);
xaw_set_label (help_terrain_special_2_data, buf);
} else {
xaw_set_label (help_terrain_special_2, "");
xaw_set_label (help_terrain_special_2_data, "");
}
- if (tile_types[i].road_trade_incr > 0)
+ if (terrains[i].road_trade_incr > 0)
{
sprintf (buf, _("+%d Trade / %d"),
- tile_types[i].road_trade_incr,
- tile_types[i].road_time);
+ terrains[i].road_trade_incr,
+ terrains[i].road_time);
}
- else if (tile_types[i].road_time > 0)
+ else if (terrains[i].road_time > 0)
{
sprintf (buf, _("no extra / %d"),
- tile_types[i].road_time);
+ terrains[i].road_time);
}
else
{
@@ -1052,46 +1052,46 @@ static void help_update_terrain(const st
xaw_set_label (help_terrain_road_result_time_data, buf);
strcpy (buf, _("n/a"));
- if (tile_types[i].irrigation_result == i)
+ if (terrains[i].irrigation_result == i)
{
- if (tile_types[i].irrigation_food_incr > 0)
+ if (terrains[i].irrigation_food_incr > 0)
{
sprintf (buf, _("+%d Food / %d"),
- tile_types[i].irrigation_food_incr,
- tile_types[i].irrigation_time);
+ terrains[i].irrigation_food_incr,
+ terrains[i].irrigation_time);
}
}
- else if (tile_types[i].irrigation_result != T_NONE)
+ else if (terrains[i].irrigation_result != T_NONE)
{
sprintf (buf, "%s / %d",
- tile_types[tile_types[i].irrigation_result].terrain_name,
- tile_types[i].irrigation_time);
+ terrains[terrains[i].irrigation_result].terrain_name,
+ terrains[i].irrigation_time);
}
xaw_set_label (help_terrain_irrigation_result_time_data, buf);
strcpy (buf, _("n/a"));
- if (tile_types[i].mining_result == i)
+ if (terrains[i].mining_result == i)
{
- if (tile_types[i].mining_shield_incr > 0)
+ if (terrains[i].mining_shield_incr > 0)
{
sprintf (buf, _("+%d Res. / %d"),
- tile_types[i].mining_shield_incr,
- tile_types[i].mining_time);
+ terrains[i].mining_shield_incr,
+ terrains[i].mining_time);
}
}
- else if (tile_types[i].mining_result != T_NONE)
+ else if (terrains[i].mining_result != T_NONE)
{
sprintf (buf, "%s / %d",
- tile_types[tile_types[i].mining_result].terrain_name,
- tile_types[i].mining_time);
+ terrains[terrains[i].mining_result].terrain_name,
+ terrains[i].mining_time);
}
xaw_set_label (help_terrain_mining_result_time_data, buf);
- if (tile_types[i].transform_result != T_NONE)
+ if (terrains[i].transform_result != T_NONE)
{
sprintf (buf, "%s / %d",
- tile_types[tile_types[i].transform_result].terrain_name,
- tile_types[i].transform_time);
+ terrains[terrains[i].transform_result].terrain_name,
+ terrains[i].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.81
diff -p -u -r1.81 menu.c
--- client/gui-xaw/menu.c 5 May 2005 18:32:49 -0000 1.81
+++ client/gui-xaw/menu.c 8 Jul 2005 20:46:59 -0000
@@ -364,10 +364,10 @@ void update_menus(void)
if (punit && can_client_issue_orders()) {
Terrain_type_id ttype;
- struct tile_type * tinfo;
+ struct terrain * tinfo;
ttype = punit->tile->terrain;
- tinfo = get_tile_type(ttype);
+ tinfo = get_terrain(ttype);
menu_entry_sensitive(MENU_ORDER, MENU_ORDER_BUILD_CITY,
can_unit_add_or_build_city(punit));
@@ -449,7 +449,7 @@ void update_menus(void)
&& (tinfo->irrigation_result != ttype)) {
menu_entry_rename(MENU_ORDER, MENU_ORDER_IRRIGATE,
TEXT_ORDER_IRRIGATE_CHANGE_TO,
-
(get_tile_type(tinfo->irrigation_result))->terrain_name);
+
(get_terrain(tinfo->irrigation_result))->terrain_name);
}
else if (tile_has_special(punit->tile, S_IRRIGATION) &&
player_knows_techs_with_flag(game.player_ptr, TF_FARMLAND)) {
@@ -464,7 +464,7 @@ void update_menus(void)
&& (tinfo->mining_result != ttype)) {
menu_entry_rename(MENU_ORDER, MENU_ORDER_MINE,
TEXT_ORDER_MINE_CHANGE_TO,
- (get_tile_type(tinfo->mining_result))->terrain_name);
+ (get_terrain(tinfo->mining_result))->terrain_name);
} else {
menu_entry_rename(MENU_ORDER, MENU_ORDER_MINE,
TEXT_ORDER_MINE_MINE, NULL);
@@ -474,7 +474,7 @@ void update_menus(void)
&& (tinfo->transform_result != ttype)) {
menu_entry_rename(MENU_ORDER, MENU_ORDER_TRANSFORM,
TEXT_ORDER_TRANSFORM_TRANSFORM_TO,
-
(get_tile_type(tinfo->transform_result))->terrain_name);
+ (get_terrain(tinfo->transform_result))->terrain_name);
} else {
menu_entry_rename(MENU_ORDER, MENU_ORDER_TRANSFORM,
TEXT_ORDER_TRANSFORM_TERRAIN, NULL);
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.352
diff -p -u -r1.352 city.c
--- common/city.c 4 Jul 2005 17:48:37 -0000 1.352
+++ common/city.c 8 Jul 2005 20:46:59 -0000
@@ -573,7 +573,7 @@ static int base_get_output_tile(const st
int city_x, int city_y, bool is_celebrating,
Output_type_id otype)
{
- const struct tile_type *ptype = get_tile_type(ptile->terrain);
+ const struct terrain *ptype = get_terrain(ptile->terrain);
struct tile tile;
int prod;
const bool auto_water = (pcity && is_city_center(city_x, city_y)
@@ -584,11 +584,11 @@ static int base_get_output_tile(const st
assert(otype >= 0 && otype < O_LAST);
if (tile_has_special(ptile, S_SPECIAL_1)) {
- prod = tile_types[ptile->terrain].special[0].output[otype];
+ prod = terrains[ptile->terrain].special[0].output[otype];
} else if (tile_has_special(ptile, S_SPECIAL_2)) {
- prod = tile_types[ptile->terrain].special[1].output[otype];
+ prod = terrains[ptile->terrain].special[1].output[otype];
} else {
- prod = tile_types[ptile->terrain].output[otype];
+ prod = terrains[ptile->terrain].output[otype];
}
/* create dummy tile which has the city center bonuses. */
Index: common/combat.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/combat.c,v
retrieving revision 1.57
diff -p -u -r1.57 combat.c
--- common/combat.c 4 Jul 2005 18:42:27 -0000 1.57
+++ common/combat.c 8 Jul 2005 20:47:00 -0000
@@ -385,7 +385,7 @@ int get_defense_power(const struct unit
{
int db, power = base_get_defense_power(punit);
- db = 10 + get_tile_type(punit->tile->terrain)->defense_bonus / 10;
+ db = 10 + get_terrain(punit->tile->terrain)->defense_bonus / 10;
if (tile_has_special(punit->tile, S_RIVER)) {
db += (db * terrain_control.river_defense_bonus) / 100;
}
@@ -493,7 +493,7 @@ int get_virtual_defense_power(Unit_type_
return 0;
}
- db = 10 + get_tile_type(t)->defense_bonus / 10;
+ db = 10 + get_terrain(t)->defense_bonus / 10;
if (tile_has_special(ptile, S_RIVER)) {
db += (db * terrain_control.river_defense_bonus) / 100;
}
Index: common/game.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.c,v
retrieving revision 1.225
diff -p -u -r1.225 game.c
--- common/game.c 8 Jul 2005 03:31:18 -0000 1.225
+++ common/game.c 8 Jul 2005 20:47:00 -0000
@@ -351,7 +351,7 @@ void ruleset_data_free()
unit_types_free();
improvements_free();
city_styles_free();
- tile_types_free();
+ terrains_free();
ruleset_cache_free();
}
@@ -573,7 +573,7 @@ void translate_data_names(void)
} impr_type_iterate_end;
terrain_type_iterate(i) {
- struct tile_type *tthis = &tile_types[i];
+ struct terrain *tthis = &terrains[i];
tthis->terrain_name = ((strcmp(tthis->terrain_name_orig, "") != 0)
? Q_(tthis->terrain_name_orig) : "");
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.230
diff -p -u -r1.230 map.c
--- common/map.c 8 Jul 2005 03:31:18 -0000 1.230
+++ common/map.c 8 Jul 2005 20:47:00 -0000
@@ -682,7 +682,7 @@ static int tile_move_cost_ptrs(struct un
}
}
- return(get_tile_type(t2->terrain)->movement_cost*SINGLE_MOVE);
+ return(get_terrain(t2->terrain)->movement_cost*SINGLE_MOVE);
}
/****************************************************************************
Index: common/terrain.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/terrain.c,v
retrieving revision 1.24
diff -p -u -r1.24 terrain.c
--- common/terrain.c 8 Jul 2005 03:31:18 -0000 1.24
+++ common/terrain.c 8 Jul 2005 20:47:00 -0000
@@ -27,7 +27,7 @@
#include "support.h"
#include "terrain.h"
-struct tile_type tile_types[MAX_NUM_TERRAINS];
+struct terrain terrains[MAX_NUM_TERRAINS];
enum tile_special_type infrastructure_specials[] = {
S_ROAD,
@@ -47,8 +47,8 @@ void terrains_init(void)
{
int i;
- for (i = 0; i < ARRAY_SIZE(tile_types); i++) {
- struct tile_type *t = get_tile_type(i);
+ for (i = 0; i < ARRAY_SIZE(terrains); i++) {
+ struct terrain *t = get_terrain(i);
t->index = i;
}
@@ -57,9 +57,9 @@ void terrains_init(void)
/***************************************************************
...
***************************************************************/
-struct tile_type *get_tile_type(Terrain_type_id type)
+struct terrain *get_terrain(Terrain_type_id type)
{
- return &tile_types[type];
+ return &terrains[type];
}
/****************************************************************************
@@ -70,7 +70,7 @@ Terrain_type_id get_terrain_by_name(cons
Terrain_type_id tt;
for (tt = T_FIRST; tt < T_COUNT; tt++) {
- if (0 == strcmp (tile_types[tt].terrain_name, name)) {
+ if (0 == strcmp (terrains[tt].terrain_name, name)) {
return tt;
}
}
@@ -84,7 +84,7 @@ Terrain_type_id get_terrain_by_name(cons
const char *get_terrain_name(Terrain_type_id type)
{
assert(type < T_COUNT);
- return tile_types[type].terrain_name;
+ return terrains[type].terrain_name;
}
/****************************************************************************
@@ -148,10 +148,10 @@ Terrain_type_id get_flag_terrain(enum te
/****************************************************************************
Free memory which is associated with terrain types.
****************************************************************************/
-void tile_types_free(void)
+void terrains_free(void)
{
terrain_type_iterate(t) {
- struct tile_type *p = get_tile_type(t);
+ struct terrain *p = get_terrain(t);
free(p->helptext);
p->helptext = NULL;
@@ -228,7 +228,7 @@ int count_terrain_property_near_tile(con
int count = 0, total = 0;
variable_adjc_iterate(ptile, adjc_tile, cardinal_only) {
- if (get_tile_type(adjc_tile->terrain)->property[prop] > 0) {
+ if (get_terrain(adjc_tile->terrain)->property[prop] > 0) {
count++;
}
total++;
Index: common/terrain.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/terrain.h,v
retrieving revision 1.37
diff -p -u -r1.37 terrain.h
--- common/terrain.h 8 Jul 2005 03:31:18 -0000 1.37
+++ common/terrain.h 8 Jul 2005 20:47:00 -0000
@@ -99,7 +99,7 @@ enum mapgen_terrain_property {
* This struct gives data about each terrain type. There are many ways
* it could be extended.
*/
-struct tile_type {
+struct terrain {
int index;
const char *terrain_name; /* Translated string - doesn't need freeing. */
char terrain_name_orig[MAX_LEN_NAME]; /* untranslated copy */
@@ -160,19 +160,19 @@ struct tile_type {
char *helptext;
};
-extern struct tile_type tile_types[MAX_NUM_TERRAINS];
+extern struct terrain terrains[MAX_NUM_TERRAINS];
/* Terrain allocation functions. */
void terrains_init(void);
/* General terrain accessor functions. */
-struct tile_type *get_tile_type(Terrain_type_id type);
+struct terrain *get_terrain(Terrain_type_id type);
Terrain_type_id get_terrain_by_name(const char * name);
const char *get_terrain_name(Terrain_type_id type);
enum terrain_flag_id terrain_flag_from_str(const char *s);
-#define terrain_has_flag(terr, flag) BV_ISSET(tile_types[(terr)].flags, flag)
+#define terrain_has_flag(terr, flag) BV_ISSET(terrains[(terr)].flags, flag)
Terrain_type_id get_flag_terrain(enum terrain_flag_id flag);
-void tile_types_free(void);
+void terrains_free(void);
/* Functions to operate on a general terrain type. */
bool is_terrain_near_tile(const struct tile *ptile, Terrain_type_id t);
Index: common/tile.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/tile.c,v
retrieving revision 1.7
diff -p -u -r1.7 tile.c
--- common/tile.c 7 Jun 2005 06:17:12 -0000 1.7
+++ common/tile.c 8 Jul 2005 20:47:00 -0000
@@ -164,23 +164,23 @@ int tile_activity_time(enum unit_activit
{
switch (activity) {
case ACTIVITY_POLLUTION:
- return tile_types[ptile->terrain].clean_pollution_time * ACTIVITY_FACTOR;
+ return terrains[ptile->terrain].clean_pollution_time * ACTIVITY_FACTOR;
case ACTIVITY_ROAD:
- return tile_types[ptile->terrain].road_time * ACTIVITY_FACTOR;
+ return terrains[ptile->terrain].road_time * ACTIVITY_FACTOR;
case ACTIVITY_MINE:
- return tile_types[ptile->terrain].mining_time * ACTIVITY_FACTOR;
+ return terrains[ptile->terrain].mining_time * ACTIVITY_FACTOR;
case ACTIVITY_IRRIGATE:
- return tile_types[ptile->terrain].irrigation_time * ACTIVITY_FACTOR;
+ return terrains[ptile->terrain].irrigation_time * ACTIVITY_FACTOR;
case ACTIVITY_FORTRESS:
- return tile_types[ptile->terrain].fortress_time * ACTIVITY_FACTOR;
+ return terrains[ptile->terrain].fortress_time * ACTIVITY_FACTOR;
case ACTIVITY_RAILROAD:
- return tile_types[ptile->terrain].rail_time * ACTIVITY_FACTOR;
+ return terrains[ptile->terrain].rail_time * ACTIVITY_FACTOR;
case ACTIVITY_TRANSFORM:
- return tile_types[ptile->terrain].transform_time * ACTIVITY_FACTOR;
+ return terrains[ptile->terrain].transform_time * ACTIVITY_FACTOR;
case ACTIVITY_AIRBASE:
- return tile_types[ptile->terrain].airbase_time * ACTIVITY_FACTOR;
+ return terrains[ptile->terrain].airbase_time * ACTIVITY_FACTOR;
case ACTIVITY_FALLOUT:
- return tile_types[ptile->terrain].clean_fallout_time * ACTIVITY_FACTOR;
+ return terrains[ptile->terrain].clean_fallout_time * ACTIVITY_FACTOR;
default:
return 0;
}
@@ -227,11 +227,11 @@ void tile_change_terrain(struct tile *pt
/* Clear mining/irrigation if resulting terrain type cannot support
* that feature. */
- if (tile_types[type].mining_result != type) {
+ if (terrains[type].mining_result != type) {
tile_clear_special(ptile, S_MINE);
}
- if (tile_types[type].irrigation_result != type) {
+ if (terrains[type].irrigation_result != type) {
tile_clear_special(ptile, S_IRRIGATION);
tile_clear_special(ptile, S_FARMLAND);
}
@@ -246,7 +246,7 @@ static void tile_irrigate(struct tile *p
Terrain_type_id now, result;
now = ptile->terrain;
- result = tile_types[now].irrigation_result;
+ result = terrains[now].irrigation_result;
if (now == result) {
if (tile_has_special(ptile, S_IRRIGATION)) {
@@ -269,7 +269,7 @@ static void tile_mine(struct tile *ptile
Terrain_type_id now, result;
now = ptile->terrain;
- result = tile_types[now].mining_result;
+ result = terrains[now].mining_result;
if (now == result) {
tile_set_special(ptile, S_MINE);
@@ -289,7 +289,7 @@ static void tile_transform(struct tile *
Terrain_type_id now, result;
now = ptile->terrain;
- result = tile_types[now].transform_result;
+ result = terrains[now].transform_result;
if (result != T_NONE) {
tile_change_terrain(ptile, result);
@@ -378,7 +378,7 @@ const char *tile_get_info_text(const str
static char s[256];
bool first;
- sz_strlcpy(s, tile_types[ptile->terrain].terrain_name);
+ sz_strlcpy(s, terrains[ptile->terrain].terrain_name);
if (tile_has_special(ptile, S_RIVER)) {
sz_strlcat(s, "/");
sz_strlcat(s, get_special_name(S_RIVER));
@@ -392,7 +392,7 @@ const char *tile_get_info_text(const str
} else {
sz_strlcat(s, "/");
}
- sz_strlcat(s, tile_types[ptile->terrain].special[0].name);
+ sz_strlcat(s, terrains[ptile->terrain].special[0].name);
}
if (tile_has_special(ptile, S_SPECIAL_2)) {
if (first) {
@@ -401,7 +401,7 @@ const char *tile_get_info_text(const str
} else {
sz_strlcat(s, "/");
}
- sz_strlcat(s, tile_types[ptile->terrain].special[1].name);
+ sz_strlcat(s, terrains[ptile->terrain].special[1].name);
}
if (!first) {
sz_strlcat(s, ")");
Index: common/unit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v
retrieving revision 1.243
diff -p -u -r1.243 unit.c
--- common/unit.c 4 Jul 2005 17:48:37 -0000 1.243
+++ common/unit.c 8 Jul 2005 20:47:00 -0000
@@ -731,7 +731,7 @@ bool can_unit_do_activity_targeted_at(co
const struct tile *ptile)
{
struct player *pplayer = unit_owner(punit);
- struct tile_type *type = get_tile_type(ptile->terrain);
+ struct terrain *type = get_terrain(ptile->terrain);
switch(activity) {
case ACTIVITY_IDLE:
Index: common/aicore/pf_tools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/pf_tools.c,v
retrieving revision 1.33
diff -p -u -r1.33 pf_tools.c
--- common/aicore/pf_tools.c 25 Jun 2005 08:05:27 -0000 1.33
+++ common/aicore/pf_tools.c 8 Jul 2005 20:47:02 -0000
@@ -137,7 +137,7 @@ static int normal_move_unit(const struct
|| is_non_allied_city_tile(ptile1, param->owner))) {
move_cost = PF_IMPOSSIBLE_MC;
} else {
- move_cost = get_tile_type(terrain1)->movement_cost * SINGLE_MOVE;
+ move_cost = get_terrain(terrain1)->movement_cost * SINGLE_MOVE;
}
} else {
move_cost = map_move_cost_ai(ptile, ptile1);
@@ -170,7 +170,7 @@ static int land_attack_move(const struct
if (!is_non_allied_unit_tile(tgt_tile, param->owner)
&& !is_non_allied_city_tile(tgt_tile, param->owner)) {
move_cost
- = get_tile_type(tgt_tile->terrain)->movement_cost * SINGLE_MOVE;
+ = get_terrain(tgt_tile->terrain)->movement_cost * SINGLE_MOVE;
} else if (BV_ISSET(param->unit_flags, F_MARINES)) {
/* Can attack!! */
move_cost = SINGLE_MOVE;
@@ -223,7 +223,7 @@ static int land_overlap_move(const struc
if (is_ocean(terrain1)) {
move_cost = SINGLE_MOVE;
} else if (is_ocean(ptile->terrain)) {
- move_cost = get_tile_type(terrain1)->movement_cost * SINGLE_MOVE;
+ move_cost = get_terrain(terrain1)->movement_cost * SINGLE_MOVE;
} else {
move_cost = map_move_cost_ai(ptile, ptile1);
}
@@ -247,7 +247,7 @@ static int reverse_move_unit(const struc
if (is_ocean(terrain1)) {
if (ground_unit_transporter_capacity(ptile, param->owner) > 0) {
/* Landing */
- move_cost = get_tile_type(terrain0)->movement_cost * SINGLE_MOVE;
+ move_cost = get_terrain(terrain0)->movement_cost * SINGLE_MOVE;
} else {
/* Nothing to land from */
move_cost = PF_IMPOSSIBLE_MC;
Index: manual/civmanual.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/manual/civmanual.c,v
retrieving revision 1.12
diff -p -u -r1.12 civmanual.c
--- manual/civmanual.c 11 May 2005 14:11:21 -0000 1.12
+++ manual/civmanual.c 8 Jul 2005 20:47:02 -0000
@@ -226,7 +226,7 @@ static bool manual_command(void)
fprintf(doc, _("<th>Transform to</th>"));
fprintf(doc, "</tr>\n");
terrain_type_iterate(id) {
- struct tile_type *ptype = get_tile_type(id);
+ struct terrain *ptype = get_terrain(id);
int s;
if (ptype->defense_bonus == 0) {
@@ -268,7 +268,7 @@ static bool manual_command(void)
fprintf(doc, _("<th>Transform</th></tr>\n"));
terrain_type_iterate(id) {
const char *name = get_terrain_name(id);
- struct tile_type *ptype = get_tile_type(id);
+ struct terrain *ptype = get_terrain(id);
if (ptype->terrain_name[0] == '\0') {
/* Must be a disabled piece of terrain */
Index: server/gotohand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gotohand.c,v
retrieving revision 1.193
diff -p -u -r1.193 gotohand.c
--- server/gotohand.c 6 May 2005 20:11:52 -0000 1.193
+++ server/gotohand.c 8 Jul 2005 20:47:03 -0000
@@ -311,7 +311,7 @@ void really_generate_warmap(struct city
else
continue;
} else if (is_ocean(ptile->terrain)) {
- int base_cost = get_tile_type(tile_get_terrain(tile1))->movement_cost
* SINGLE_MOVE;
+ int base_cost = get_terrain(tile_get_terrain(tile1))->movement_cost *
SINGLE_MOVE;
move_cost = igter ? MOVE_COST_ROAD : MIN(base_cost,
unit_move_rate(punit));
} else if (igter)
/* NOT c = 1 (Syela) [why not? - Thue] */
@@ -655,7 +655,7 @@ static bool find_the_shortest_path(struc
else
move_cost = 3;
} else if (is_ocean(psrctile->terrain)) {
- int base_cost = get_tile_type(pdesttile->terrain)->movement_cost *
SINGLE_MOVE;
+ int base_cost = get_terrain(pdesttile->terrain)->movement_cost *
SINGLE_MOVE;
move_cost = igter ? 1 : MIN(base_cost, unit_move_rate(punit));
} else if (igter)
move_cost = (map_move_cost_ai(psrctile, pdesttile) != 0
Index: server/maphand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/maphand.c,v
retrieving revision 1.168
diff -p -u -r1.168 maphand.c
--- server/maphand.c 4 Jul 2005 17:48:38 -0000 1.168
+++ server/maphand.c 8 Jul 2005 20:47:03 -0000
@@ -215,9 +215,9 @@ void global_warming(int effect)
ptile = rand_map_pos();
old = tile_get_terrain(ptile);
if (is_terrain_ecologically_wet(ptile)) {
- new = get_tile_type(old)->warmer_wetter_result;
+ new = get_terrain(old)->warmer_wetter_result;
} else {
- new = get_tile_type(old)->warmer_drier_result;
+ new = get_terrain(old)->warmer_drier_result;
}
if (new != T_NONE && old != new) {
effect--;
@@ -257,9 +257,9 @@ void nuclear_winter(int effect)
ptile = rand_map_pos();
old = tile_get_terrain(ptile);
if (is_terrain_ecologically_wet(ptile)) {
- new = get_tile_type(old)->cooler_wetter_result;
+ new = get_terrain(old)->cooler_wetter_result;
} else {
- new = get_tile_type(old)->cooler_drier_result;
+ new = get_terrain(old)->cooler_drier_result;
}
if (new != T_NONE && old != new) {
effect--;
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.270
diff -p -u -r1.270 ruleset.c
--- server/ruleset.c 28 Jun 2005 17:21:03 -0000 1.270
+++ server/ruleset.c 8 Jul 2005 20:47:04 -0000
@@ -659,14 +659,14 @@ static Terrain_type_id lookup_terrain(ch
}
for (i = T_FIRST; i < T_COUNT; i++) {
- if (0 == strcmp(name, tile_types[i].terrain_name)) {
+ if (0 == strcmp(name, terrains[i].terrain_name)) {
return i;
}
}
/* TRANS: message for an obscure ruleset error. */
freelog(LOG_ERROR, _("Unknown terrain %s in entry %s."),
- name, tile_types[tthis].terrain_name);
+ name, terrains[tthis].terrain_name);
return T_NONE;
}
@@ -1405,11 +1405,11 @@ static void load_terrain_names(struct se
terrain_type_iterate(i) {
char *name = secfile_lookup_str(file, "%s.terrain_name", sec[i]);
- name_strlcpy(tile_types[i].terrain_name_orig, name);
- if (0 == strcmp(tile_types[i].terrain_name_orig, "unused")) {
- tile_types[i].terrain_name_orig[0] = '\0';
+ name_strlcpy(terrains[i].terrain_name_orig, name);
+ if (0 == strcmp(terrains[i].terrain_name_orig, "unused")) {
+ terrains[i].terrain_name_orig[0] = '\0';
}
- tile_types[i].terrain_name = tile_types[i].terrain_name_orig;
+ terrains[i].terrain_name = terrains[i].terrain_name_orig;
} terrain_type_iterate_end;
free(sec);
@@ -1491,7 +1491,7 @@ static void load_ruleset_terrain(struct
/* terrain details */
terrain_type_iterate(i) {
- struct tile_type *t = &(tile_types[i]);
+ struct terrain *t = &(terrains[i]);
char **slist;
sz_strlcpy(t->graphic_str,
@@ -1501,11 +1501,11 @@ static void load_ruleset_terrain(struct
t->identifier = secfile_lookup_str(file, "%s.identifier", sec[i])[0];
for (j = T_FIRST; j < i; j++) {
- if (t->identifier == tile_types[j].identifier) {
+ if (t->identifier == terrains[j].identifier) {
freelog(LOG_FATAL,
/* TRANS: message for an obscure ruleset error. */
_("Terrains %s and %s have the same identifier."),
- t->terrain_name, tile_types[j].terrain_name);
+ t->terrain_name, terrains[j].terrain_name);
exit(EXIT_FAILURE);
}
}
@@ -1989,7 +1989,7 @@ static struct city_name* load_city_name_
* However this is not a problem because we take care of rivers
* separately.
*/
- if (mystrcasecmp(name, tile_types[type].terrain_name) == 0) {
+ if (mystrcasecmp(name, terrains[type].terrain_name) == 0) {
city_names[j].terrain[type] = setting;
handled = TRUE;
}
@@ -2773,7 +2773,7 @@ static void send_ruleset_terrain(struct
lsend_packet_ruleset_terrain_control(dest, &terrain_control);
terrain_type_iterate(i) {
- struct tile_type *t = &(tile_types[i]);
+ struct terrain *t = &(terrains[i]);
packet.id = i;
Index: server/sanitycheck.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sanitycheck.c,v
retrieving revision 1.68
diff -p -u -r1.68 sanitycheck.c
--- server/sanitycheck.c 4 Jul 2005 17:48:38 -0000 1.68
+++ server/sanitycheck.c 8 Jul 2005 20:47:04 -0000
@@ -66,9 +66,9 @@ static void check_specials(void)
SANITY_CHECK(!contains_special(special, S_SPECIAL_2));
if (contains_special(special, S_MINE))
- SANITY_CHECK(get_tile_type(terrain)->mining_result == terrain);
+ SANITY_CHECK(get_terrain(terrain)->mining_result == terrain);
if (contains_special(special, S_IRRIGATION))
- SANITY_CHECK(get_tile_type(terrain)->irrigation_result == terrain);
+ SANITY_CHECK(get_terrain(terrain)->irrigation_result == terrain);
SANITY_CHECK(terrain >= T_FIRST && terrain < T_COUNT);
} whole_map_iterate_end;
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.259
diff -p -u -r1.259 savegame.c
--- server/savegame.c 4 Jul 2005 17:48:38 -0000 1.259
+++ server/savegame.c 8 Jul 2005 20:47:05 -0000
@@ -226,7 +226,7 @@ static int ascii_hex2bin(char ch, int ha
}
/****************************************************************************
- Dereferences the terrain character. See tile_types[].identifier
+ Dereferences the terrain character. See terrains[].identifier
example: char2terrain('a') => T_ARCTIC
****************************************************************************/
static Terrain_type_id char2terrain(char ch)
@@ -235,7 +235,7 @@ static Terrain_type_id char2terrain(char
return T_UNKNOWN;
}
terrain_type_iterate(id) {
- if (tile_types[id].identifier == ch) {
+ if (terrains[id].identifier == ch) {
return id;
}
} terrain_type_iterate_end;
@@ -246,7 +246,7 @@ static Terrain_type_id char2terrain(char
}
/****************************************************************************
- References the terrain character. See tile_types[].identifier
+ References the terrain character. See terrains[].identifier
example: terrain2char(T_ARCTIC) => 'a'
****************************************************************************/
static char terrain2char(Terrain_type_id terr)
@@ -255,7 +255,7 @@ static char terrain2char(Terrain_type_id
return UNKNOWN_TERRAIN_IDENTIFIER;
} else {
assert(terr >= T_FIRST && terr < T_COUNT);
- return tile_types[terr].identifier;
+ return terrains[terr].identifier;
}
}
Index: server/settlers.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.242
diff -p -u -r1.242 settlers.c
--- server/settlers.c 4 Jul 2005 17:48:38 -0000 1.242
+++ server/settlers.c 8 Jul 2005 20:47:05 -0000
@@ -295,7 +295,7 @@ static int ai_calc_irrigate(struct city
int goodness;
Terrain_type_id old_terrain = ptile->terrain;
bv_special old_special = ptile->special;
- struct tile_type *type = get_tile_type(old_terrain);
+ struct terrain *type = get_terrain(old_terrain);
Terrain_type_id new_terrain = type->irrigation_result;
if (old_terrain != new_terrain && new_terrain != T_NONE) {
@@ -360,7 +360,7 @@ static int ai_calc_mine(struct city *pci
int goodness;
Terrain_type_id old_terrain = ptile->terrain;
bv_special old_special = ptile->special;
- struct tile_type *type = get_tile_type(old_terrain);
+ struct terrain *type = get_terrain(old_terrain);
Terrain_type_id new_terrain = type->mining_result;
if (old_terrain != new_terrain && new_terrain != T_NONE) {
@@ -412,7 +412,7 @@ static int ai_calc_transform(struct city
int goodness;
Terrain_type_id old_terrain = ptile->terrain;
bv_special old_special = ptile->special;
- struct tile_type *type = get_tile_type(old_terrain);
+ struct terrain *type = get_terrain(old_terrain);
Terrain_type_id new_terrain = type->transform_result;
if (old_terrain == new_terrain || new_terrain == T_NONE) {
@@ -436,10 +436,10 @@ static int ai_calc_transform(struct city
ptile->terrain = new_terrain;
- if (get_tile_type(new_terrain)->mining_result != new_terrain) {
+ if (get_terrain(new_terrain)->mining_result != new_terrain) {
tile_clear_special(ptile, S_MINE);
}
- if (get_tile_type(new_terrain)->irrigation_result != new_terrain) {
+ if (get_terrain(new_terrain)->irrigation_result != new_terrain) {
tile_clear_special(ptile, S_FARMLAND);
tile_clear_special(ptile, S_IRRIGATION);
}
@@ -476,7 +476,7 @@ static int road_bonus(struct tile *ptile
has_road[i] = FALSE;
is_slow[i] = FALSE; /* FIXME: should be TRUE? */
} else {
- struct tile_type *ptype = get_tile_type(tile1->terrain);
+ struct terrain *ptype = get_terrain(tile1->terrain);
has_road[i] = tile_has_special(tile1, special);
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.368
diff -p -u -r1.368 unittools.c
--- server/unittools.c 4 Jul 2005 18:42:28 -0000 1.368
+++ server/unittools.c 8 Jul 2005 20:47:06 -0000
@@ -1205,7 +1205,7 @@ bool enemies_at(struct unit *punit, stru
}
/* Calculate how well we can defend at (x,y) */
- db = 10 + get_tile_type(tile_get_terrain(ptile))->defense_bonus / 10;
+ db = 10 + get_terrain(tile_get_terrain(ptile))->defense_bonus / 10;
if (tile_has_special(ptile, S_RIVER))
db += (db * terrain_control.river_defense_bonus) / 100;
d = unit_def_rating_basic_sq(punit) * db;
Index: server/generator/mapgen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/generator/mapgen.c,v
retrieving revision 1.27
diff -p -u -r1.27 mapgen.c
--- server/generator/mapgen.c 23 Jun 2005 15:36:46 -0000 1.27
+++ server/generator/mapgen.c 8 Jul 2005 20:47:06 -0000
@@ -244,15 +244,15 @@ static Terrain_type_id pick_terrain(enum
/* Find the total weight. */
terrain_type_iterate(terrain) {
- if (avoid != MG_LAST && get_tile_type(terrain)->property[avoid] > 0) {
+ if (avoid != MG_LAST && get_terrain(terrain)->property[avoid] > 0) {
continue;
}
- if (prefer != MG_LAST && get_tile_type(terrain)->property[prefer] == 0) {
+ if (prefer != MG_LAST && get_terrain(terrain)->property[prefer] == 0) {
continue;
}
if (target != MG_LAST) {
- sum += get_tile_type(terrain)->property[target];
+ sum += get_terrain(terrain)->property[target];
} else {
sum++;
}
@@ -265,15 +265,15 @@ static Terrain_type_id pick_terrain(enum
terrain_type_iterate(terrain) {
int property;
- if (avoid != MG_LAST && get_tile_type(terrain)->property[avoid] > 0) {
+ if (avoid != MG_LAST && get_terrain(terrain)->property[avoid] > 0) {
continue;
}
- if (prefer != MG_LAST && get_tile_type(terrain)->property[prefer] == 0) {
+ if (prefer != MG_LAST && get_terrain(terrain)->property[prefer] == 0) {
continue;
}
if (target != MG_LAST) {
- property = get_tile_type(terrain)->property[target];
+ property = get_terrain(terrain)->property[target];
} else {
property = 1;
}
@@ -301,11 +301,11 @@ static Terrain_type_id pick_ocean(int de
{
Terrain_type_id best_terrain = get_flag_terrain(TER_OCEANIC);
int best_match
- = abs(depth - get_tile_type(best_terrain)->property[MG_OCEAN_DEPTH]);
+ = abs(depth - get_terrain(best_terrain)->property[MG_OCEAN_DEPTH]);
terrain_type_iterate(t) {
if (terrain_has_flag(t, TER_OCEANIC)) {
- int match = abs(depth - get_tile_type(t)->property[MG_OCEAN_DEPTH]);
+ int match = abs(depth - get_terrain(t)->property[MG_OCEAN_DEPTH]);
if (match < best_match) {
best_match = match;
@@ -584,7 +584,7 @@ static int river_test_rivergrid(struct t
*********************************************************************/
static int river_test_highlands(struct tile *ptile)
{
- return get_tile_type(ptile->terrain)->property[MG_MOUNTAINOUS];
+ return get_terrain(ptile->terrain)->property[MG_MOUNTAINOUS];
}
/*********************************************************************
@@ -611,7 +611,7 @@ static int river_test_adjacent_highlands
int sum = 0;
adjc_iterate(ptile, ptile2) {
- sum += get_tile_type(ptile2->terrain)->property[MG_MOUNTAINOUS];
+ sum += get_terrain(ptile2->terrain)->property[MG_MOUNTAINOUS];
} adjc_iterate_end;
return sum;
@@ -622,7 +622,7 @@ static int river_test_adjacent_highlands
*********************************************************************/
static int river_test_swamp(struct tile *ptile)
{
- return FC_INFINITY - get_tile_type(ptile->terrain)->property[MG_WET];
+ return FC_INFINITY - get_terrain(ptile->terrain)->property[MG_WET];
}
/*********************************************************************
@@ -633,7 +633,7 @@ static int river_test_adjacent_swamp(str
int sum = 0;
adjc_iterate(ptile, ptile2) {
- sum += get_tile_type(ptile2->terrain)->property[MG_WET];
+ sum += get_terrain(ptile2->terrain)->property[MG_WET];
} adjc_iterate_end;
return FC_INFINITY - sum;
@@ -792,7 +792,7 @@ static bool make_river(struct tile *ptil
/* We arbitrarily make rivers end at the poles. */
if (count_special_near_tile(ptile, TRUE, TRUE, S_RIVER) > 0
|| count_ocean_near_tile(ptile, TRUE, TRUE) > 0
- || (get_tile_type(ptile->terrain)->property[MG_FROZEN] > 0
+ || (get_terrain(ptile->terrain)->property[MG_FROZEN] > 0
&& map_colatitude(ptile) < 0.8 * COLD_LEVEL)) {
freelog(LOG_DEBUG,
@@ -946,17 +946,17 @@ static void make_rivers(void)
/* Don't start a river on hills unless it is hard to find
somewhere else to start it. */
- && (get_tile_type(ptile->terrain)->property[MG_MOUNTAINOUS] == 0
+ && (get_terrain(ptile->terrain)->property[MG_MOUNTAINOUS] == 0
|| iteration_counter >= RIVERS_MAXTRIES / 10 * 6)
/* Don't start a river on arctic unless it is hard to find
somewhere else to start it. */
- && (get_tile_type(ptile->terrain)->property[MG_FROZEN] == 0
+ && (get_terrain(ptile->terrain)->property[MG_FROZEN] == 0
|| iteration_counter >= RIVERS_MAXTRIES / 10 * 8)
/* Don't start a river on desert unless it is hard to find
somewhere else to start it. */
- && (get_tile_type(ptile->terrain)->property[MG_DRY] == 0
+ && (get_terrain(ptile->terrain)->property[MG_DRY] == 0
|| iteration_counter >= RIVERS_MAXTRIES / 10 * 9)) {
/* Reset river_map before making a new river. */
@@ -1048,7 +1048,7 @@ static bool is_tiny_island(struct tile *
{
Terrain_type_id t = tile_get_terrain(ptile);
- if (is_ocean(t) || get_tile_type(t)->property[MG_FROZEN] > 0) {
+ if (is_ocean(t) || get_terrain(t)->property[MG_FROZEN] > 0) {
/* The arctic check is needed for iso-maps: the poles may not have
* any cardinally adjacent land tiles, but that's okay. */
return FALSE;
@@ -1328,20 +1328,20 @@ static void add_specials(int prob)
if (!is_ocean(ttype)
&& !is_special_close(ptile)
&& myrand(1000) < prob) {
- if (tile_types[ttype].special[0].name[0] != '\0'
- && (tile_types[ttype].special[1].name[0] == '\0'
+ if (terrains[ttype].special[0].name[0] != '\0'
+ && (terrains[ttype].special[1].name[0] == '\0'
|| (myrand(100) < 50))) {
tile_set_special(ptile, S_SPECIAL_1);
- } else if (tile_types[ttype].special[1].name[0] != '\0') {
+ } else if (terrains[ttype].special[1].name[0] != '\0') {
tile_set_special(ptile, S_SPECIAL_2);
}
} else if (is_ocean(ttype) && near_safe_tiles(ptile)
&& myrand(1000) < prob && !is_special_close(ptile)) {
- if (tile_types[ttype].special[0].name[0] != '\0'
- && (tile_types[ttype].special[1].name[0] == '\0'
+ if (terrains[ttype].special[0].name[0] != '\0'
+ && (terrains[ttype].special[1].name[0] == '\0'
|| (myrand(100) < 50))) {
tile_set_special(ptile, S_SPECIAL_1);
- } else if (tile_types[ttype].special[1].name[0] != '\0') {
+ } else if (terrains[ttype].special[1].name[0] != '\0') {
tile_set_special(ptile, S_SPECIAL_2);
}
}
Index: server/scripting/api_find.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/scripting/api_find.c,v
retrieving revision 1.5
diff -p -u -r1.5 api_find.c
--- server/scripting/api_find.c 10 May 2005 20:33:08 -0000 1.5
+++ server/scripting/api_find.c 8 Jul 2005 20:47:06 -0000
@@ -149,7 +149,7 @@ Tech_Type *api_find_tech_type_by_name(co
**************************************************************************/
Terrain *api_find_terrain(int terrain_id)
{
- return get_tile_type(terrain_id);
+ return get_terrain(terrain_id);
}
/**************************************************************************
Index: server/scripting/api_types.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/scripting/api_types.h,v
retrieving revision 1.7
diff -p -u -r1.7 api_types.h
--- server/scripting/api_types.h 10 May 2005 20:33:09 -0000 1.7
+++ server/scripting/api_types.h 8 Jul 2005 20:47:06 -0000
@@ -39,7 +39,7 @@ typedef struct nation_type Nation_Type;
typedef struct impr_type Building_Type;
typedef struct unit_type Unit_Type;
typedef struct advance Tech_Type;
-typedef struct tile_type Terrain;
+typedef struct terrain Terrain;
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#13424) rename "struct tile_type" as "struct terrain",
Jason Short <=
|
|