[Freeciv-Dev] (PR#9761) replace enum tile_terrain_type with Terrain_type
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#9761) replace enum tile_terrain_type with Terrain_type_id |
From: |
"Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> |
Date: |
Sun, 22 Aug 2004 11:28:59 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9761 >
I sent this before but I think RT was broken.
-------- Original Message --------
Subject: replace enum tile_terrain_type with Terrain_type_id
Date: Sun, 22 Aug 2004 14:04:44 -0400
From: Jason Dorje Short <jdorje@xxxxxxxxxxxx>
To: rt@xxxxxxxxxxxxxx
This patch replaces users of the enum tile_terrain_type type with a
Terrain_type_id typedef. This corresponds to what is done in
improvement.h with Improvement_type_id. Eventually this enum can be
removed and we can just have an integer value here.
The patch is easy to recreate. Run
replace.sh "enum tile_terrain_type" Terrain_type_id
then replace the terrain.h changes with the given patch.
jason
Index: ai/aiunit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v
retrieving revision 1.327
diff -u -r1.327 aiunit.c
--- ai/aiunit.c 13 Aug 2004 15:59:12 -0000 1.327
+++ ai/aiunit.c 22 Aug 2004 18:02:13 -0000
@@ -798,7 +798,7 @@
bool find_beachhead(struct unit *punit, int dest_x, int dest_y, int *x, int *y)
{
int ok, best = 0;
- enum tile_terrain_type t;
+ Terrain_type_id t;
CHECK_UNIT(punit);
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.140
diff -u -r1.140 mapview_common.c
--- client/mapview_common.c 22 Aug 2004 01:43:12 -0000 1.140
+++ client/mapview_common.c 22 Aug 2004 18:02:13 -0000
@@ -1321,7 +1321,7 @@
int map_x, int map_y,
int canvas_x, int canvas_y)
{
- enum tile_terrain_type t1 = map_get_terrain(map_x, map_y), t2;
+ Terrain_type_id t1 = map_get_terrain(map_x, map_y), t2;
if (!draw_coastline || draw_terrain || t1 == T_UNKNOWN) {
return;
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.195
diff -u -r1.195 tilespec.c
--- client/tilespec.c 11 Aug 2004 18:25:38 -0000 1.195
+++ client/tilespec.c 22 Aug 2004 18:02:14 -0000
@@ -1587,7 +1587,7 @@
Set tile_type sprite values; should only happen after
tilespec_load_tiles().
***********************************************************************/
-void tilespec_setup_tile_type(enum tile_terrain_type terrain)
+void tilespec_setup_tile_type(Terrain_type_id terrain)
{
struct tile_type *tt = get_tile_type(terrain);
struct terrain_drawing_data *draw;
@@ -1886,9 +1886,9 @@
tspecial_near : specials of all adjacent terrain
**************************************************************************/
static void build_tile_data(int map_x, int map_y,
- enum tile_terrain_type *ttype,
+ Terrain_type_id *ttype,
enum tile_special_type *tspecial,
- enum tile_terrain_type *ttype_near,
+ Terrain_type_id *ttype_near,
enum tile_special_type *tspecial_near)
{
enum direction8 dir;
@@ -2364,10 +2364,10 @@
****************************************************************************/
static int fill_blending_sprite_array(struct drawn_sprite *sprs,
int map_x, int map_y,
- enum tile_terrain_type *ttype_near)
+ Terrain_type_id *ttype_near)
{
struct drawn_sprite *saved_sprs = sprs;
- enum tile_terrain_type ttype = map_get_terrain(map_x, map_y);
+ Terrain_type_id ttype = map_get_terrain(map_x, map_y);
if (is_isometric && sprites.terrain[ttype]->is_blended) {
enum direction4 dir;
@@ -2383,7 +2383,7 @@
*/
for (dir = 0; dir < 4; dir++) {
int x1, y1;
- enum tile_terrain_type other = ttype_near[DIR4_TO_DIR8[dir]];
+ Terrain_type_id other = ttype_near[DIR4_TO_DIR8[dir]];
if (!MAPSTEP(x1, y1, map_x, map_y, DIR4_TO_DIR8[dir])
|| tile_get_known(x1, y1) == TILE_UNKNOWN
@@ -2406,12 +2406,12 @@
****************************************************************************/
static int fill_terrain_sprite_array(struct drawn_sprite *sprs,
int map_x, int map_y,
- enum tile_terrain_type *ttype_near)
+ Terrain_type_id *ttype_near)
{
struct drawn_sprite *saved_sprs = sprs;
struct Sprite *sprite;
struct tile *ptile = map_get_tile(map_x, map_y);
- enum tile_terrain_type ttype = ptile->terrain;
+ Terrain_type_id ttype = ptile->terrain;
struct terrain_drawing_data *draw = sprites.terrain[ttype];
int l, adjc_x, adjc_y, i, tileno;
@@ -2584,7 +2584,7 @@
bool *solid_bg, enum color_std *bg_color,
int map_x, int map_y, bool citymode)
{
- enum tile_terrain_type ttype, ttype_near[8];
+ Terrain_type_id ttype, ttype_near[8];
enum tile_special_type tspecial, tspecial_near[8];
int tileno, dir;
struct tile *ptile = map_get_tile(map_x, map_y);
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.83
diff -u -r1.83 tilespec.h
--- client/tilespec.h 2 Aug 2004 16:23:18 -0000 1.83
+++ client/tilespec.h 22 Aug 2004 18:02:14 -0000
@@ -58,7 +58,7 @@
void tilespec_setup_unit_type(int id);
void tilespec_setup_impr_type(int id);
void tilespec_setup_tech_type(int id);
-void tilespec_setup_tile_type(enum tile_terrain_type terrain);
+void tilespec_setup_tile_type(Terrain_type_id terrain);
void tilespec_setup_government(int id);
void tilespec_setup_nation_flag(int id);
void tilespec_setup_city_tiles(int style);
Index: client/gui-gtk/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/menu.c,v
retrieving revision 1.85
diff -u -r1.85 menu.c
--- client/gui-gtk/menu.c 17 Aug 2004 07:25:27 -0000 1.85
+++ client/gui-gtk/menu.c 22 Aug 2004 18:02:14 -0000
@@ -1121,7 +1121,7 @@
char *transfmt = _("Transf_orm to %s");
char irrtext[128], mintext[128], transtext[128];
char *roadtext;
- enum tile_terrain_type ttype;
+ Terrain_type_id ttype;
struct tile_type * tinfo;
sz_strlcpy(irrtext, _("Build _Irrigation"));
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.35
diff -u -r1.35 menu.c
--- client/gui-gtk-2.0/menu.c 21 Aug 2004 16:34:03 -0000 1.35
+++ client/gui-gtk-2.0/menu.c 22 Aug 2004 18:02:15 -0000
@@ -1197,7 +1197,7 @@
const char *transfmt = _("Transf_orm to %s");
char irrtext[128], mintext[128], transtext[128];
const char *roadtext;
- enum tile_terrain_type ttype;
+ Terrain_type_id ttype;
struct tile_type * tinfo;
sz_strlcpy(irrtext, _("Build _Irrigation"));
Index: client/gui-mui/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/graphics.c,v
retrieving revision 1.33
diff -u -r1.33 graphics.c
--- client/gui-mui/graphics.c 11 May 2004 17:40:06 -0000 1.33
+++ client/gui-mui/graphics.c 22 Aug 2004 18:02:15 -0000
@@ -942,7 +942,7 @@
}
if (draw_coastline && !draw_terrain) {
- enum tile_terrain_type t1 = map_get_terrain(x, y), t2;
+ Terrain_type_id t1 = map_get_terrain(x, y), t2;
int x1 = x-1, y1 = y;
SetAPen(rp,GetColorPen(COLOR_STD_OCEAN));
if (normalize_map_pos(&x1, &y1)) {
@@ -1343,7 +1343,7 @@
}
if (draw_coastline && !draw_terrain) {
- enum tile_terrain_type t1 = map_get_terrain(x, y), t2;
+ Terrain_type_id t1 = map_get_terrain(x, y), t2;
int x1, y1;
SetAPen(rp,GetColorPen(COLOR_STD_OCEAN));
x1 = x; y1 = y-1;
Index: client/gui-mui/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/gui_main.c,v
retrieving revision 1.83
diff -u -r1.83 gui_main.c
--- client/gui-mui/gui_main.c 10 Jul 2004 18:48:18 -0000 1.83
+++ client/gui-mui/gui_main.c 22 Aug 2004 18:02:15 -0000
@@ -1227,7 +1227,7 @@
static char irrtext[64];
static char mintext[64];
static char transtext[64];
- enum tile_terrain_type ttype;
+ Terrain_type_id ttype;
struct tile_type *tinfo;
set(main_menu, MUIA_Window_Menustrip, NULL);
Index: client/gui-sdl/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/mapview.c,v
retrieving revision 1.70
diff -u -r1.70 mapview.c
--- client/gui-sdl/mapview.c 10 Jul 2004 18:48:18 -0000 1.70
+++ client/gui-sdl/mapview.c 22 Aug 2004 18:02:16 -0000
@@ -113,7 +113,7 @@
static void init_borders_tiles(void);
static void free_borders_tiles(void);
static void fill_dither_buffers(SDL_Surface **pDitherBufs, int x, int y,
- enum tile_terrain_type terrain);
+ Terrain_type_id terrain);
static void draw_map_cell(SDL_Surface * pDest, Sint16 map_x, Sint16 map_y,
@@ -2079,12 +2079,12 @@
/**************************************************************************
...
**************************************************************************/
-static bool is_full_ocean(enum tile_terrain_type t, int x, int y)
+static bool is_full_ocean(Terrain_type_id t, int x, int y)
{
if (is_ocean(t))
{
- enum tile_terrain_type ter;
+ Terrain_type_id ter;
adjc_iterate(x, y, x1, y1) {
ter = map_get_terrain(x1, y1);
if (!is_ocean(ter) && ter != T_UNKNOWN) {
@@ -2114,7 +2114,7 @@
static struct city *pCity = NULL;
static struct unit *pUnit = NULL, *pFocus = NULL;
static enum tile_special_type special;
- static enum tile_terrain_type terrain;
+ static Terrain_type_id terrain;
static int count, i;
static bool fog, full_ocean, solid_bg;
@@ -3206,9 +3206,9 @@
...
**************************************************************************/
static void fill_dither_buffers(SDL_Surface **pDitherBufs, int x, int y,
- enum tile_terrain_type terrain)
+ Terrain_type_id terrain)
{
- enum tile_terrain_type __ter[8];
+ Terrain_type_id __ter[8];
enum direction8 dir;
int x1, y1;
@@ -3248,7 +3248,7 @@
**************************************************************************/
static void init_dither_tiles(void)
{
- enum tile_terrain_type terrain;
+ Terrain_type_id terrain;
int i , w = NORMAL_TILE_WIDTH / 2, h = NORMAL_TILE_HEIGHT / 2;
SDL_Rect src = { 0 , 0 , w , h };
SDL_Surface *pTerrain_Surface, *pBuf = create_surf(NORMAL_TILE_WIDTH,
@@ -3325,7 +3325,7 @@
**************************************************************************/
static void free_dither_tiles(void)
{
- enum tile_terrain_type terrain;
+ Terrain_type_id terrain;
int i;
for (terrain = T_ARCTIC ; terrain < T_LAST ; terrain++)
@@ -3343,7 +3343,7 @@
**************************************************************************/
static void clear_dither_tiles(void)
{
- enum tile_terrain_type terrain;
+ Terrain_type_id terrain;
int i;
for (terrain = T_ARCTIC ; terrain < T_LAST ; terrain++)
{
Index: client/gui-sdl/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/menu.c,v
retrieving revision 1.25
diff -u -r1.25 menu.c
--- client/gui-sdl/menu.c 1 Apr 2004 23:46:25 -0000 1.25
+++ client/gui-sdl/menu.c 22 Aug 2004 18:02:16 -0000
@@ -942,7 +942,7 @@
struct city *pHomecity;
int time;
struct tile *pTile = map_get_tile(pUnit->x, pUnit->y);
- enum tile_terrain_type terrain = pTile->terrain;
+ Terrain_type_id terrain = pTile->terrain;
if (!counter) {
local_show(ID_UNIT_ORDER_GOTO);
Index: client/gui-win32/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/menu.c,v
retrieving revision 1.21
diff -u -r1.21 menu.c
--- client/gui-win32/menu.c 17 Jun 2004 00:04:07 -0000 1.21
+++ client/gui-win32/menu.c 22 Aug 2004 18:02:17 -0000
@@ -923,7 +923,7 @@
char *transfmt = _("Transform to %s");
char irrtext[128], mintext[128], transtext[128];
char *roadtext;
- enum tile_terrain_type ttype;
+ Terrain_type_id ttype;
struct tile_type * tinfo;
sz_strlcpy(irrtext, _("Build Irrigation"));
Index: client/gui-xaw/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/menu.c,v
retrieving revision 1.63
diff -u -r1.63 menu.c
--- client/gui-xaw/menu.c 17 May 2004 01:29:47 -0000 1.63
+++ client/gui-xaw/menu.c 22 Aug 2004 18:02:17 -0000
@@ -323,7 +323,7 @@
(game.player_ptr->spaceship.state!=SSHIP_NONE));
if (punit && can_client_issue_orders()) {
- enum tile_terrain_type ttype;
+ Terrain_type_id ttype;
struct tile_type * tinfo;
ttype = map_get_tile(punit->x, punit->y)->terrain;
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.236
diff -u -r1.236 city.c
--- common/city.c 20 Aug 2004 20:13:17 -0000 1.236
+++ common/city.c 22 Aug 2004 18:02:18 -0000
@@ -370,7 +370,7 @@
bool city_has_terr_spec_gate(const struct city *pcity, Impr_Type_id id)
{
struct impr_type *impr;
- enum tile_terrain_type *terr_gate;
+ Terrain_type_id *terr_gate;
enum tile_special_type *spec_gate;
impr = get_improvement_type(id);
@@ -580,7 +580,7 @@
int city_x, int city_y, bool is_celebrating)
{
enum tile_special_type spec_t = map_get_special(map_x, map_y);
- enum tile_terrain_type tile_t = map_get_terrain(map_x, map_y);
+ Terrain_type_id tile_t = map_get_terrain(map_x, map_y);
int s;
if (contains_special(spec_t, S_SPECIAL_1)) {
@@ -685,7 +685,7 @@
int city_x, int city_y, bool is_celebrating)
{
enum tile_special_type spec_t = map_get_special(map_x, map_y);
- enum tile_terrain_type tile_t = map_get_terrain(map_x, map_y);
+ Terrain_type_id tile_t = map_get_terrain(map_x, map_y);
int t;
if (contains_special(spec_t, S_SPECIAL_1)) {
@@ -798,7 +798,7 @@
int city_x, int city_y, bool is_celebrating)
{
const enum tile_special_type spec_t = map_get_special(map_x, map_y);
- const enum tile_terrain_type tile_t = map_get_terrain(map_x, map_y);
+ const Terrain_type_id tile_t = map_get_terrain(map_x, map_y);
struct tile_type *type = get_tile_type(tile_t);
int f;
const bool auto_water = (pcity && is_city_center(city_x, city_y)
@@ -918,7 +918,7 @@
if (punit) {
enum unit_move_type move_type = unit_type(punit)->move_type;
- enum tile_terrain_type t = map_get_terrain(x, y);
+ Terrain_type_id t = map_get_terrain(x, y);
/* We allow land units to build land cities and sea units to build
* ocean cities. */
Index: common/combat.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/combat.c,v
retrieving revision 1.44
diff -u -r1.44 combat.c
--- common/combat.c 25 Jun 2004 23:43:01 -0000 1.44
+++ common/combat.c 22 Aug 2004 18:02:18 -0000
@@ -78,8 +78,8 @@
bool can_unit_attack_unit_at_tile(struct unit *punit, struct unit *pdefender,
int dest_x, int dest_y)
{
- enum tile_terrain_type fromtile;
- enum tile_terrain_type totile;
+ Terrain_type_id fromtile;
+ Terrain_type_id totile;
struct city *pcity = map_get_city(dest_x, dest_y);
fromtile = map_get_terrain(punit->x, punit->y);
@@ -464,7 +464,7 @@
int x, int y, bool fortified, int veteran)
{
int defensepower = unit_types[def_type].defense_strength;
- enum tile_terrain_type t = map_get_terrain(x, y);
+ Terrain_type_id t = map_get_terrain(x, y);
int db;
if (unit_types[def_type].move_type == LAND_MOVING && is_ocean(t)) {
Index: common/improvement.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/improvement.h,v
retrieving revision 1.28
diff -u -r1.28 improvement.h
--- common/improvement.h 13 Aug 2004 15:59:12 -0000 1.28
+++ common/improvement.h 22 Aug 2004 18:02:18 -0000
@@ -19,7 +19,7 @@
#include "shared.h" /* MAX_LEN_NAME */
#include "tech.h" /* Tech_Type_id */
-#include "terrain.h" /* enum tile_terrain_type etc */
+#include "terrain.h" /* Terrain_type_id etc */
#include "unittype.h" /* Unit_Class_id, Unit_Type_id */
#include "effects.h"
@@ -89,7 +89,7 @@
Tech_Type_id cond_adv; /* A_NONE = unconditional; A_LAST = never */
enum effect_type cond_eff; /* EFT_LAST = unconditional */
Unit_Class_id aff_unit; /* UCL_LAST = all */
- enum tile_terrain_type aff_terr; /* T_UNKNOWN = all; T_LAST = none */
+ Terrain_type_id aff_terr; /* T_UNKNOWN = all; T_LAST = none */
enum tile_special_type aff_spec; /* S_* bit mask of specials affected */
};
@@ -105,7 +105,7 @@
char graphic_alt[MAX_LEN_NAME]; /* city icon of improv. */
Tech_Type_id tech_req; /* A_LAST = never; A_NONE = always */
Impr_Type_id bldg_req; /* B_LAST = none required */
- enum tile_terrain_type *terr_gate; /* list; T_LAST terminated */
+ Terrain_type_id *terr_gate; /* list; T_LAST terminated */
enum tile_special_type *spec_gate; /* list; S_NO_SPECIAL terminated */
enum impr_range equiv_range;
Impr_Type_id *equiv_dupl; /* list; B_LAST terminated */
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.187
diff -u -r1.187 map.c
--- common/map.c 13 Aug 2004 15:59:12 -0000 1.187
+++ common/map.c 22 Aug 2004 18:02:18 -0000
@@ -627,7 +627,7 @@
bool is_safe_ocean(int x, int y)
{
adjc_iterate(x, y, x1, y1) {
- enum tile_terrain_type ter = map_get_terrain(x1, y1);
+ Terrain_type_id ter = map_get_terrain(x1, y1);
if (!terrain_has_flag(ter, TER_UNSAFE_COAST) && ter != T_UNKNOWN) {
return TRUE;
}
@@ -915,7 +915,7 @@
***************************************************************/
void map_irrigate_tile(int x, int y)
{
- enum tile_terrain_type now, result;
+ Terrain_type_id now, result;
now = map_get_terrain(x, y);
result = tile_types[now].irrigation_result;
@@ -945,7 +945,7 @@
***************************************************************/
void map_mine_tile(int x, int y)
{
- enum tile_terrain_type now, result;
+ Terrain_type_id now, result;
now = map_get_terrain(x, y);
result = tile_types[now].mining_result;
@@ -969,7 +969,7 @@
/***************************************************************
...
***************************************************************/
-void change_terrain(int x, int y, enum tile_terrain_type type)
+void change_terrain(int x, int y, Terrain_type_id type)
{
map_set_terrain(x, y, type);
if (is_ocean(type)) {
@@ -998,7 +998,7 @@
***************************************************************/
void map_transform_tile(int x, int y)
{
- enum tile_terrain_type now, result;
+ Terrain_type_id now, result;
now = map_get_terrain(x, y);
result = tile_types[now].transform_result;
@@ -1265,7 +1265,7 @@
/***************************************************************
...
***************************************************************/
-enum tile_terrain_type map_get_terrain(int x, int y)
+Terrain_type_id map_get_terrain(int x, int y)
{
return MAP_TILE(x, y)->terrain;
}
@@ -1273,7 +1273,7 @@
/****************************************************************************
Return the terrain type of the given tile (in native coordinates).
****************************************************************************/
-enum tile_terrain_type nat_get_terrain(int nat_x, int nat_y)
+Terrain_type_id nat_get_terrain(int nat_x, int nat_y)
{
return NAT_TILE(nat_x, nat_y)->terrain;
}
@@ -1326,7 +1326,7 @@
/***************************************************************
...
***************************************************************/
-void map_set_terrain(int x, int y, enum tile_terrain_type ter)
+void map_set_terrain(int x, int y, Terrain_type_id ter)
{
MAP_TILE(x, y)->terrain = ter;
}
@@ -1334,7 +1334,7 @@
/****************************************************************************
Set the terrain of the given tile (in native coordinates).
****************************************************************************/
-void nat_set_terrain(int nat_x, int nat_y, enum tile_terrain_type ter)
+void nat_set_terrain(int nat_x, int nat_y, Terrain_type_id ter)
{
NAT_TILE(nat_x, nat_y)->terrain = ter;
}
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.204
diff -u -r1.204 map.h
--- common/map.h 13 Aug 2004 15:59:12 -0000 1.204
+++ common/map.h 22 Aug 2004 18:02:19 -0000
@@ -37,7 +37,7 @@
};
struct tile {
- enum tile_terrain_type terrain;
+ Terrain_type_id terrain;
enum tile_special_type special;
struct city *city;
struct unit_list units;
@@ -101,15 +101,15 @@
int road_trade_incr;
int road_time;
- enum tile_terrain_type irrigation_result;
+ Terrain_type_id irrigation_result;
int irrigation_food_incr;
int irrigation_time;
- enum tile_terrain_type mining_result;
+ Terrain_type_id mining_result;
int mining_shield_incr;
int mining_time;
- enum tile_terrain_type transform_result;
+ Terrain_type_id transform_result;
int transform_time;
int rail_time;
int airbase_time;
@@ -342,11 +342,11 @@
void map_set_owner(int x, int y, struct player *pplayer);
struct city *map_get_city(int x, int y);
void map_set_city(int x, int y, struct city *pcity);
-enum tile_terrain_type map_get_terrain(int x, int y);
-enum tile_terrain_type nat_get_terrain(int nat_x, int nat_y);
+Terrain_type_id map_get_terrain(int x, int y);
+Terrain_type_id nat_get_terrain(int nat_x, int nat_y);
enum tile_special_type map_get_special(int x, int y);
-void map_set_terrain(int x, int y, enum tile_terrain_type ter);
-void nat_set_terrain(int nat_x, int nat_y, enum tile_terrain_type ter);
+void map_set_terrain(int x, int y, Terrain_type_id ter);
+void nat_set_terrain(int nat_x, int nat_y, Terrain_type_id ter);
void map_set_special(int x, int y, enum tile_special_type spe);
void map_clear_special(int x, int y, enum tile_special_type spe);
void map_clear_all_specials(int x, int y);
@@ -396,7 +396,7 @@
void map_irrigate_tile(int x, int y);
void map_mine_tile(int x, int y);
-void change_terrain(int x, int y, enum tile_terrain_type type);
+void change_terrain(int x, int y, Terrain_type_id type);
void map_transform_tile(int x, int y);
int map_build_road_time(int x, int y);
Index: common/packets_gen.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets_gen.h,v
retrieving revision 1.36
diff -u -r1.36 packets_gen.h
--- common/packets_gen.h 20 Aug 2004 20:13:17 -0000 1.36
+++ common/packets_gen.h 22 Aug 2004 18:02:19 -0000
@@ -96,7 +96,7 @@
struct packet_tile_info {
int x;
int y;
- enum tile_terrain_type type;
+ Terrain_type_id type;
int known;
enum tile_special_type special;
int owner;
@@ -907,7 +907,7 @@
char soundtag_alt[MAX_LEN_NAME];
char helptext[MAX_LEN_PACKET];
int terr_gate_count;
- enum tile_terrain_type terr_gate[255];
+ Terrain_type_id terr_gate[255];
int spec_gate_count;
enum tile_special_type spec_gate[255];
int equiv_dupl_count;
@@ -919,7 +919,7 @@
};
struct packet_ruleset_terrain {
- enum tile_terrain_type id;
+ Terrain_type_id id;
bv_terrain_flags flags;
char terrain_name[MAX_LEN_NAME];
char graphic_str[MAX_LEN_NAME];
@@ -943,13 +943,13 @@
char graphic_alt_special_2[MAX_LEN_NAME];
int road_trade_incr;
int road_time;
- enum tile_terrain_type irrigation_result;
+ Terrain_type_id irrigation_result;
int irrigation_food_incr;
int irrigation_time;
- enum tile_terrain_type mining_result;
+ Terrain_type_id mining_result;
int mining_shield_incr;
int mining_time;
- enum tile_terrain_type transform_result;
+ Terrain_type_id transform_result;
int transform_time;
int rail_time;
int airbase_time;
Index: common/terrain.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/terrain.c,v
retrieving revision 1.9
diff -u -r1.9 terrain.c
--- common/terrain.c 9 Jul 2004 18:52:36 -0000 1.9
+++ common/terrain.c 22 Aug 2004 18:02:19 -0000
@@ -29,7 +29,7 @@
/***************************************************************
...
***************************************************************/
-struct tile_type *get_tile_type(enum tile_terrain_type type)
+struct tile_type *get_tile_type(Terrain_type_id type)
{
return &tile_types[type];
}
@@ -37,9 +37,9 @@
/***************************************************************
...
***************************************************************/
-enum tile_terrain_type get_terrain_by_name(const char * name)
+Terrain_type_id get_terrain_by_name(const char * name)
{
- enum tile_terrain_type tt;
+ Terrain_type_id tt;
for (tt = T_FIRST; tt < T_COUNT; tt++) {
if (0 == strcmp (tile_types[tt].terrain_name, name)) {
break;
@@ -51,7 +51,7 @@
/***************************************************************
...
***************************************************************/
-const char *get_terrain_name(enum tile_terrain_type type)
+const char *get_terrain_name(Terrain_type_id type)
{
assert(type < T_COUNT);
return tile_types[type].terrain_name;
@@ -90,7 +90,7 @@
/****************************************************************************
Return a random terrain that has the specified flag.
****************************************************************************/
-enum tile_terrain_type get_flag_terrain(enum terrain_flag_id flag)
+Terrain_type_id get_flag_terrain(enum terrain_flag_id flag)
{
bool has_flag[T_COUNT];
int count = 0;
@@ -131,7 +131,7 @@
/****************************************************************************
Returns TRUE iff any adjacent tile contains the given terrain.
****************************************************************************/
-bool is_terrain_near_tile(int map_x, int map_y, enum tile_terrain_type t)
+bool is_terrain_near_tile(int map_x, int map_y, Terrain_type_id t)
{
adjc_iterate(map_x, map_y, adjc_x, adjc_y) {
if (map_get_terrain(adjc_x, adjc_y) == t) {
@@ -145,7 +145,7 @@
/****************************************************************************
Return the number of adjacent tiles that have the given terrain.
****************************************************************************/
-int count_terrain_near_tile(int map_x, int map_y, enum tile_terrain_type t)
+int count_terrain_near_tile(int map_x, int map_y, Terrain_type_id t)
{
int count = 0;
@@ -161,7 +161,7 @@
/****************************************************************************
Return the number of cardinally adjacent tiles that have the given terrain.
****************************************************************************/
-int adjacent_terrain_tiles4(int map_x, int map_y, enum tile_terrain_type t)
+int adjacent_terrain_tiles4(int map_x, int map_y, Terrain_type_id t)
{
int num_adjacent = 0;
Index: common/terrain.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/terrain.h,v
retrieving revision 1.18
diff -u -r1.18 terrain.h
--- common/terrain.h 21 Aug 2004 23:14:43 -0000 1.18
+++ common/terrain.h 22 Aug 2004 18:02:19 -0000
@@ -70,6 +70,7 @@
#define T_FIRST (T_ARCTIC)
#define T_COUNT (T_UNKNOWN)
#define MAX_NUM_TERRAINS (T_LAST)
+typedef enum tile_terrain_type Terrain_type_id;
/* Must match with terrain_flag_from_str in terrain.c. */
enum terrain_flag_id {
@@ -96,18 +97,18 @@
extern struct tile_type tile_types[T_LAST];
/* General accessor functions. */
-struct tile_type *get_tile_type(enum tile_terrain_type type);
-enum tile_terrain_type get_terrain_by_name(const char * name);
-const char *get_terrain_name(enum tile_terrain_type type);
+struct tile_type *get_tile_type(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)
-enum tile_terrain_type get_flag_terrain(enum terrain_flag_id flag);
+Terrain_type_id get_flag_terrain(enum terrain_flag_id flag);
void tile_types_free(void);
/* Functions to operate on a general terrain type. */
-bool is_terrain_near_tile(int map_x, int map_y, enum tile_terrain_type t);
-int count_terrain_near_tile(int map_x, int map_y, enum tile_terrain_type t);
-int adjacent_terrain_tiles4(int map_x, int map_y, enum tile_terrain_type t);
+bool is_terrain_near_tile(int map_x, int map_y, Terrain_type_id t);
+int count_terrain_near_tile(int map_x, int map_y, Terrain_type_id t);
+int adjacent_terrain_tiles4(int map_x, int map_y, Terrain_type_id t);
/* Functions to operate on a terrain flag. */
bool is_terrain_flag_near_tile(int x, int y, enum terrain_flag_id flag);
@@ -125,7 +126,7 @@
/* This iterator iterates over all terrain types. */
#define terrain_type_iterate(id) \
{ \
- enum tile_terrain_type id; \
+ Terrain_type_id id; \
for (id = T_FIRST; id < T_COUNT; id++) {
#define terrain_type_iterate_end \
Index: common/aicore/pf_tools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/pf_tools.c,v
retrieving revision 1.19
diff -u -r1.19 pf_tools.c
--- common/aicore/pf_tools.c 6 Aug 2004 13:43:12 -0000 1.19
+++ common/aicore/pf_tools.c 22 Aug 2004 18:02:19 -0000
@@ -120,7 +120,7 @@
int x1, int y1, struct pf_parameter *param)
{
struct tile *ptile = map_get_tile(x, y);
- enum tile_terrain_type terrain1 = map_get_terrain(x1, y1);
+ Terrain_type_id terrain1 = map_get_terrain(x1, y1);
int move_cost;
if (is_ocean(terrain1)) {
@@ -218,7 +218,7 @@
int x1, int y1, struct pf_parameter *param)
{
struct tile *ptile = map_get_tile(x, y);
- enum tile_terrain_type terrain1 = map_get_terrain(x1, y1);
+ Terrain_type_id terrain1 = map_get_terrain(x1, y1);
int move_cost;
if (is_ocean(terrain1)) {
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.269
diff -u -r1.269 citytools.c
--- server/citytools.c 6 Aug 2004 16:46:24 -0000 1.269
+++ server/citytools.c 22 Aug 2004 18:02:22 -0000
@@ -78,7 +78,7 @@
/* Lower values mean higher priority. */
float priority = (float)default_priority;
int goodness;
- enum tile_terrain_type type;
+ Terrain_type_id type;
/* Increasing this value will increase the difference caused by
(non-)matching terrain. A matching terrain is mult_factor
Index: server/mapgen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/mapgen.c,v
retrieving revision 1.144
diff -u -r1.144 mapgen.c
--- server/mapgen.c 19 Aug 2004 07:34:25 -0000 1.144
+++ server/mapgen.c 22 Aug 2004 18:02:23 -0000
@@ -234,7 +234,7 @@
struct DataFilter {
int T_min, T_max;
- enum tile_terrain_type terrain;
+ Terrain_type_id terrain;
};
/****************************************************************************
@@ -258,7 +258,7 @@
****************************************************************************/
static bool rand_map_pos_temperature(int *map_x, int *map_y,
int T_min, int T_max,
- enum tile_terrain_type terrain)
+ Terrain_type_id terrain)
{
struct DataFilter filter;
@@ -1000,7 +1000,7 @@
if (make_river(x, y)) {
whole_map_iterate(x1, y1) {
if (TEST_BIT(rmap(x1, y1), RS_RIVER)) {
- enum tile_terrain_type t = map_get_terrain(x1, y1);
+ Terrain_type_id t = map_get_terrain(x1, y1);
if (!terrain_has_flag(t, TER_CAN_HAVE_RIVER)) {
/* We have to change the terrain to put a river here. */
@@ -1173,7 +1173,7 @@
**************************************************************************/
static bool is_tiny_island(int x, int y)
{
- enum tile_terrain_type t = map_get_terrain(x, y);
+ Terrain_type_id t = map_get_terrain(x, y);
if (is_ocean(t) || t == T_ARCTIC) {
/* The arctic check is needed for iso-maps: the poles may not have
@@ -1268,7 +1268,7 @@
static int get_tile_value(int x, int y)
{
struct tile *ptile = map_get_tile(x, y);
- enum tile_terrain_type old_terrain;
+ Terrain_type_id old_terrain;
enum tile_special_type old_special;
int value, irrig_bonus, mine_bonus;
@@ -1430,7 +1430,7 @@
{
struct start_filter_data *data = dataptr;
int i;
- enum tile_terrain_type t = map_get_terrain(x, y);
+ Terrain_type_id t = map_get_terrain(x, y);
if (is_ocean(map_get_terrain(x, y))) {
return FALSE;
@@ -1864,7 +1864,7 @@
****************************************************************************/
static void add_specials(int prob)
{
- enum tile_terrain_type ttype;
+ Terrain_type_id ttype;
whole_map_iterate(x, y) {
ttype = map_get_terrain(x, y);
@@ -1935,10 +1935,10 @@
static void fill_island(int coast, long int *bucket,
int warm0_weight, int warm1_weight,
int cold0_weight, int cold1_weight,
- enum tile_terrain_type warm0,
- enum tile_terrain_type warm1,
- enum tile_terrain_type cold0,
- enum tile_terrain_type cold1,
+ Terrain_type_id warm0,
+ Terrain_type_id warm1,
+ Terrain_type_id cold0,
+ Terrain_type_id cold1,
const struct gen234_state *const pstate)
{
int x, y, i, k, capac;
Index: server/maphand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/maphand.c,v
retrieving revision 1.139
diff -u -r1.139 maphand.c
--- server/maphand.c 20 Aug 2004 10:14:28 -0000 1.139
+++ server/maphand.c 22 Aug 2004 18:02:23 -0000
@@ -1309,9 +1309,9 @@
continent numbers.
**************************************************************************/
enum ocean_land_change check_terrain_ocean_land_change(int x, int y,
- enum tile_terrain_type oldter)
+ Terrain_type_id oldter)
{
- enum tile_terrain_type newter = map_get_terrain(x, y);
+ Terrain_type_id newter = map_get_terrain(x, y);
if (is_ocean(oldter) && !is_ocean(newter)) {
/* ocean to land ... */
Index: server/maphand.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/maphand.h,v
retrieving revision 1.40
diff -u -r1.40 maphand.h
--- server/maphand.h 9 Aug 2004 05:24:35 -0000 1.40
+++ server/maphand.h 22 Aug 2004 18:02:23 -0000
@@ -36,7 +36,7 @@
};
struct player_tile {
- enum tile_terrain_type terrain;
+ Terrain_type_id terrain;
enum tile_special_type special;
unsigned short seen;
unsigned short own_seen;
@@ -96,5 +96,5 @@
void map_calculate_borders(void);
enum ocean_land_change check_terrain_ocean_land_change(int x, int y,
- enum tile_terrain_type oldter);
+ Terrain_type_id oldter);
#endif /* FC__MAPHAND_H */
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.186
diff -u -r1.186 ruleset.c
--- server/ruleset.c 20 Aug 2004 20:13:18 -0000 1.186
+++ server/ruleset.c 22 Aug 2004 18:02:25 -0000
@@ -69,8 +69,8 @@
const char *entry, const char *filename);
static char *lookup_helptext(struct section_file *file, char *prefix);
-static enum tile_terrain_type lookup_terrain(char *name,
- enum tile_terrain_type tthis);
+static Terrain_type_id lookup_terrain(char *name,
+ Terrain_type_id tthis);
static void load_tech_names(struct section_file *file);
static void load_unit_names(struct section_file *file);
@@ -474,10 +474,10 @@
/**************************************************************************
Look up a terrain name in the tile_types array and return its index.
**************************************************************************/
-static enum tile_terrain_type lookup_terrain(char *name,
- enum tile_terrain_type tthis)
+static Terrain_type_id lookup_terrain(char *name,
+ Terrain_type_id tthis)
{
- enum tile_terrain_type i;
+ Terrain_type_id i;
if (*name == '\0' || (0 == strcmp(name, "none"))
|| (0 == strcmp(name, "no"))) {
@@ -2139,7 +2139,7 @@
} else {
/* "handled" tracks whether we find a match (for error handling) */
bool handled = FALSE;
- enum tile_terrain_type type;
+ Terrain_type_id type;
for (type = T_FIRST; type < T_COUNT && !handled; type++) {
/*
Index: server/sanitycheck.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sanitycheck.c,v
retrieving revision 1.46
diff -u -r1.46 sanitycheck.c
--- server/sanitycheck.c 13 Aug 2004 15:59:13 -0000 1.46
+++ server/sanitycheck.c 22 Aug 2004 18:02:25 -0000
@@ -38,7 +38,7 @@
static void check_specials(void)
{
whole_map_iterate(x, y) {
- enum tile_terrain_type terrain = map_get_terrain(x, y);
+ Terrain_type_id terrain = map_get_terrain(x, y);
enum tile_special_type special = map_get_special(x, y);
if (contains_special(special, S_RAILROAD))
Index: server/settlers.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.196
diff -u -r1.196 settlers.c
--- server/settlers.c 17 Aug 2004 05:13:59 -0000 1.196
+++ server/settlers.c 22 Aug 2004 18:02:25 -0000
@@ -325,7 +325,7 @@
**************************************************************************/
static bool is_wet(struct player *pplayer, int map_x, int map_y)
{
- enum tile_terrain_type terrain;
+ Terrain_type_id terrain;
enum tile_special_type special;
/* FIXME: this should check a handicap. */
@@ -389,10 +389,10 @@
{
int goodness;
struct tile *ptile = map_get_tile(map_x, map_y);
- enum tile_terrain_type old_terrain = ptile->terrain;
+ Terrain_type_id old_terrain = ptile->terrain;
enum tile_special_type old_special = ptile->special;
struct tile_type *type = get_tile_type(old_terrain);
- enum tile_terrain_type new_terrain = type->irrigation_result;
+ Terrain_type_id new_terrain = type->irrigation_result;
if (old_terrain != new_terrain && new_terrain != T_LAST) {
/* Irrigation would change the terrain type, clearing the mine
@@ -453,10 +453,10 @@
{
int goodness;
struct tile *ptile = map_get_tile(map_x, map_y);
- enum tile_terrain_type old_terrain = ptile->terrain;
+ Terrain_type_id old_terrain = ptile->terrain;
enum tile_special_type old_special = ptile->special;
struct tile_type *type = get_tile_type(old_terrain);
- enum tile_terrain_type new_terrain = type->mining_result;
+ Terrain_type_id new_terrain = type->mining_result;
if (old_terrain != new_terrain && new_terrain != T_LAST) {
/* Mining would change the terrain type, clearing the irrigation
@@ -506,10 +506,10 @@
{
int goodness;
struct tile *ptile = map_get_tile(map_x, map_y);
- enum tile_terrain_type old_terrain = ptile->terrain;
+ Terrain_type_id old_terrain = ptile->terrain;
enum tile_special_type old_special = ptile->special;
struct tile_type *type = get_tile_type(old_terrain);
- enum tile_terrain_type new_terrain = type->transform_result;
+ Terrain_type_id new_terrain = type->transform_result;
if (old_terrain == new_terrain || new_terrain == T_LAST) {
return -1;
@@ -1236,7 +1236,7 @@
city_x, city_y, map_x, map_y) {
#ifndef NDEBUG
struct tile *ptile = map_get_tile(map_x, map_y);
- enum tile_terrain_type old_terrain = ptile->terrain;
+ Terrain_type_id old_terrain = ptile->terrain;
enum tile_special_type old_special = ptile->special;
#endif
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.298
diff -u -r1.298 unittools.c
--- server/unittools.c 13 Aug 2004 15:59:13 -0000 1.298
+++ server/unittools.c 22 Aug 2004 18:02:26 -0000
@@ -731,7 +731,7 @@
if (activity==ACTIVITY_IRRIGATE) {
if (total_activity (punit->x, punit->y, ACTIVITY_IRRIGATE) >=
map_build_irrigation_time(punit->x, punit->y)) {
- enum tile_terrain_type old = map_get_terrain(punit->x, punit->y);
+ Terrain_type_id old = map_get_terrain(punit->x, punit->y);
map_irrigate_tile(punit->x, punit->y);
solvency = check_terrain_ocean_land_change(punit->x, punit->y, old);
unit_activity_done = TRUE;
@@ -758,7 +758,7 @@
if (activity==ACTIVITY_MINE) {
if (total_activity (punit->x, punit->y, ACTIVITY_MINE) >=
map_build_mine_time(punit->x, punit->y)) {
- enum tile_terrain_type old = map_get_terrain(punit->x, punit->y);
+ Terrain_type_id old = map_get_terrain(punit->x, punit->y);
map_mine_tile(punit->x, punit->y);
solvency = check_terrain_ocean_land_change(punit->x, punit->y, old);
unit_activity_done = TRUE;
@@ -768,7 +768,7 @@
if (activity==ACTIVITY_TRANSFORM) {
if (total_activity (punit->x, punit->y, ACTIVITY_TRANSFORM) >=
map_transform_time(punit->x, punit->y)) {
- enum tile_terrain_type old = map_get_terrain(punit->x, punit->y);
+ Terrain_type_id old = map_get_terrain(punit->x, punit->y);
map_transform_tile(punit->x, punit->y);
solvency = check_terrain_ocean_land_change(punit->x, punit->y, old);
unit_activity_done = TRUE;
@@ -2482,7 +2482,7 @@
unit_list_iterate(map_get_tile(x, y)->units, penemy) {
int range;
enum unit_move_type move_type = unit_type(penemy)->move_type;
- enum tile_terrain_type terrain = map_get_terrain(x, y);
+ Terrain_type_id terrain = map_get_terrain(x, y);
if (map_has_special(x, y, S_FORTRESS)
&& unit_profits_of_watchtower(penemy))
replace.sh
Description: Bourne shell script
Index: common/terrain.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/terrain.h,v
retrieving revision 1.18
diff -u -r1.18 terrain.h
--- common/terrain.h 21 Aug 2004 23:14:43 -0000 1.18
+++ common/terrain.h 22 Aug 2004 18:02:42 -0000
@@ -70,6 +70,7 @@
#define T_FIRST (T_ARCTIC)
#define T_COUNT (T_UNKNOWN)
#define MAX_NUM_TERRAINS (T_LAST)
+typedef enum tile_terrain_type Terrain_type_id;
/* Must match with terrain_flag_from_str in terrain.c. */
enum terrain_flag_id {
@@ -96,18 +97,18 @@
extern struct tile_type tile_types[T_LAST];
/* General accessor functions. */
-struct tile_type *get_tile_type(enum tile_terrain_type type);
-enum tile_terrain_type get_terrain_by_name(const char * name);
-const char *get_terrain_name(enum tile_terrain_type type);
+struct tile_type *get_tile_type(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)
-enum tile_terrain_type get_flag_terrain(enum terrain_flag_id flag);
+Terrain_type_id get_flag_terrain(enum terrain_flag_id flag);
void tile_types_free(void);
/* Functions to operate on a general terrain type. */
-bool is_terrain_near_tile(int map_x, int map_y, enum tile_terrain_type t);
-int count_terrain_near_tile(int map_x, int map_y, enum tile_terrain_type t);
-int adjacent_terrain_tiles4(int map_x, int map_y, enum tile_terrain_type t);
+bool is_terrain_near_tile(int map_x, int map_y, Terrain_type_id t);
+int count_terrain_near_tile(int map_x, int map_y, Terrain_type_id t);
+int adjacent_terrain_tiles4(int map_x, int map_y, Terrain_type_id t);
/* Functions to operate on a terrain flag. */
bool is_terrain_flag_near_tile(int x, int y, enum terrain_flag_id flag);
@@ -125,7 +126,7 @@
/* This iterator iterates over all terrain types. */
#define terrain_type_iterate(id) \
{ \
- enum tile_terrain_type id; \
+ Terrain_type_id id; \
for (id = T_FIRST; id < T_COUNT; id++) {
#define terrain_type_iterate_end \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#9761) replace enum tile_terrain_type with Terrain_type_id,
Jason Short <=
|
|