[Freeciv-Dev] (PR#9787) RFC: generalized terrain
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9787 >
This idea has been discussed in other tickets. The idea is to remove
the hard-coding of terrain types from the code. The terrain types then
come entirely from the ruleset.
Most of the work is done. Most of the rest of the work is easy. This
patch does that. This is a target patch, not a patch intended for
inclusion in CVS.
What remains is mapgen, which is hard. Marcelo had some ideas about it
but I'm not sure I understand them. Marcelo: how would your mapgen
ideas work with this patch?
jason
? diff
Index: ai/aiferry.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aiferry.c,v
retrieving revision 1.3
diff -u -r1.3 aiferry.c
--- ai/aiferry.c 6 Aug 2004 14:46:28 -0000 1.3
+++ ai/aiferry.c 24 Aug 2004 03:23:07 -0000
@@ -237,7 +237,7 @@
if (is_ocean(tgt_tile->terrain)) {
/* Any-to-Sea */
move_cost = 0;
- } else if (src_tile->terrain == T_OCEAN) {
+ } else if (is_ocean(src_tile->terrain)) {
/* Sea-to-Land */
move_cost = PF_IMPOSSIBLE_MC;
} else {
Index: ai/aisettler.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aisettler.c,v
retrieving revision 1.3
diff -u -r1.3 aisettler.c
--- ai/aisettler.c 7 Aug 2004 17:58:56 -0000 1.3
+++ ai/aisettler.c 24 Aug 2004 03:23:08 -0000
@@ -314,7 +314,7 @@
**************************************************************************/
static int naval_bonus(struct cityresult *result, struct ai_data *ai)
{
- bool ocean_adjacent = is_terrain_near_tile(result->x, result->y, T_OCEAN);
+ bool ocean_adjacent = is_ocean_near_tile(result->x, result->y);
/* Adjust for ocean adjacency, which is nice */
if (ocean_adjacent) {
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 24 Aug 2004 03:23:08 -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/helpdata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/helpdata.c,v
retrieving revision 1.71
diff -u -r1.71 helpdata.c
--- client/helpdata.c 18 Aug 2004 04:23:20 -0000 1.71
+++ client/helpdata.c 24 Aug 2004 03:23:09 -0000
@@ -113,15 +113,15 @@
tile_types[i].road_time,
tile_types[i].irrigation_time,
((tile_types[i].irrigation_result == i) ||
- (tile_types[i].irrigation_result == T_LAST)) ? "" :
+ (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_LAST)) ? "" :
+ (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_LAST)) ? "" :
+ (tile_types[i].transform_result == T_NONE)) ? "" :
tile_types[tile_types[i].transform_result].terrain_name
);
}
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 24 Aug 2004 03:23:09 -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/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.396
diff -u -r1.396 packhand.c
--- client/packhand.c 20 Aug 2004 20:13:17 -0000 1.396
+++ client/packhand.c 24 Aug 2004 03:23:10 -0000
@@ -2188,6 +2188,8 @@
city_styles_alloc(packet->style_count);
tilespec_alloc_city_tiles(game.styles_count);
+ game.terrain_count = packet->terrain_count;
+
for(i = 0; i < MAX_NUM_TEAMS; i++) {
mystrlcpy(team_get_by_id(i)->name, packet->team_name[i],
MAX_LEN_NAME);
@@ -2320,7 +2322,7 @@
} \
b->elem[p->count] = last;
- T(terr_gate, terr_gate_count, T_LAST);
+ T(terr_gate, terr_gate_count, T_NONE);
T(spec_gate, spec_gate_count, S_NO_SPECIAL);
T(equiv_dupl, equiv_dupl_count, B_LAST);
T(equiv_repl, equiv_repl_count, B_LAST);
@@ -2350,7 +2352,7 @@
"None" :
improvement_types[b->bldg_req].name);
freelog(LOG_DEBUG, " terr_gate...");
- for (inx = 0; b->terr_gate[inx] != T_LAST; inx++) {
+ for (inx = 0; b->terr_gate[inx] != T_NONE; inx++) {
freelog(LOG_DEBUG, " %2d/%s",
b->terr_gate[inx], get_terrain_name(b->terr_gate[inx]));
}
@@ -2437,7 +2439,7 @@
ptr = strchr(ptr, '\0');
my_snprintf(ptr, sizeof(buf)-(ptr-buf), " aff_terr=%d/%s",
b->effect[inx].aff_terr,
- (b->effect[inx].aff_terr == T_LAST) ?
+ (b->effect[inx].aff_terr == T_NONE) ?
"None" :
(b->effect[inx].aff_terr == T_UNKNOWN) ?
"All" :
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 24 Aug 2004 03:23:10 -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 24 Aug 2004 03:23:10 -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/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/helpdlg.c,v
retrieving revision 1.66
diff -u -r1.66 helpdlg.c
--- client/gui-gtk/helpdlg.c 18 Aug 2004 04:23:20 -0000 1.66
+++ client/gui-gtk/helpdlg.c 24 Aug 2004 03:23:11 -0000
@@ -989,7 +989,7 @@
tile_types[i].irrigation_time);
}
}
- else if (tile_types[i].irrigation_result != T_LAST)
+ else if (tile_types[i].irrigation_result != T_NONE)
{
sprintf (buf, "%s / %d",
tile_types[tile_types[i].irrigation_result].terrain_name,
@@ -1007,7 +1007,7 @@
tile_types[i].mining_time);
}
}
- else if (tile_types[i].mining_result != T_LAST)
+ else if (tile_types[i].mining_result != T_NONE)
{
sprintf (buf, "%s / %d",
tile_types[tile_types[i].mining_result].terrain_name,
@@ -1015,7 +1015,7 @@
}
gtk_set_label (help_tlabel[3][1], buf);
- if (tile_types[i].transform_result != T_LAST)
+ if (tile_types[i].transform_result != T_NONE)
{
sprintf (buf, "%s / %d",
tile_types[tile_types[i].transform_result].terrain_name,
Index: client/gui-gtk/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/menu.c,v
retrieving revision 1.86
diff -u -r1.86 menu.c
--- client/gui-gtk/menu.c 23 Aug 2004 19:49:57 -0000 1.86
+++ client/gui-gtk/menu.c 24 Aug 2004 03:23:11 -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"));
@@ -1219,7 +1219,7 @@
ttype = map_get_tile(punit->x, punit->y)->terrain;
tinfo = get_tile_type(ttype);
- if ((tinfo->irrigation_result != T_LAST) && (tinfo->irrigation_result !=
ttype))
+ if ((tinfo->irrigation_result != T_NONE) && (tinfo->irrigation_result !=
ttype))
{
my_snprintf (irrtext, sizeof(irrtext), irrfmt,
(get_tile_type(tinfo->irrigation_result))->terrain_name);
@@ -1229,12 +1229,12 @@
{
sz_strlcpy (irrtext, _("Bu_ild Farmland"));
}
- if ((tinfo->mining_result != T_LAST) && (tinfo->mining_result != ttype))
+ if ((tinfo->mining_result != T_NONE) && (tinfo->mining_result != ttype))
{
my_snprintf (mintext, sizeof(mintext), minfmt,
(get_tile_type(tinfo->mining_result))->terrain_name);
}
- if ((tinfo->transform_result != T_LAST) && (tinfo->transform_result !=
ttype))
+ if ((tinfo->transform_result != T_NONE) && (tinfo->transform_result !=
ttype))
{
my_snprintf (transtext, sizeof(transtext), transfmt,
(get_tile_type(tinfo->transform_result))->terrain_name);
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.33
diff -u -r1.33 helpdlg.c
--- client/gui-gtk-2.0/helpdlg.c 18 Aug 2004 04:23:20 -0000 1.33
+++ client/gui-gtk-2.0/helpdlg.c 24 Aug 2004 03:23:11 -0000
@@ -1055,7 +1055,7 @@
tile_types[i].irrigation_time);
}
}
- else if (tile_types[i].irrigation_result != T_LAST)
+ else if (tile_types[i].irrigation_result != T_NONE)
{
sprintf (buf, "%s / %d",
tile_types[tile_types[i].irrigation_result].terrain_name,
@@ -1073,7 +1073,7 @@
tile_types[i].mining_time);
}
}
- else if (tile_types[i].mining_result != T_LAST)
+ else if (tile_types[i].mining_result != T_NONE)
{
sprintf (buf, "%s / %d",
tile_types[tile_types[i].mining_result].terrain_name,
@@ -1081,7 +1081,7 @@
}
gtk_label_set_text(GTK_LABEL(help_tlabel[3][1]), buf);
- if (tile_types[i].transform_result != T_LAST)
+ if (tile_types[i].transform_result != T_NONE)
{
sprintf (buf, "%s / %d",
tile_types[tile_types[i].transform_result].terrain_name,
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 24 Aug 2004 03:23:11 -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"));
@@ -1295,7 +1295,7 @@
ttype = map_get_tile(punit->x, punit->y)->terrain;
tinfo = get_tile_type(ttype);
- if ((tinfo->irrigation_result != T_LAST) && (tinfo->irrigation_result !=
ttype))
+ if ((tinfo->irrigation_result != T_NONE) && (tinfo->irrigation_result !=
ttype))
{
my_snprintf (irrtext, sizeof(irrtext), irrfmt,
(get_tile_type(tinfo->irrigation_result))->terrain_name);
@@ -1305,12 +1305,12 @@
{
sz_strlcpy (irrtext, _("Bu_ild Farmland"));
}
- if ((tinfo->mining_result != T_LAST) && (tinfo->mining_result != ttype))
+ if ((tinfo->mining_result != T_NONE) && (tinfo->mining_result != ttype))
{
my_snprintf (mintext, sizeof(mintext), minfmt,
(get_tile_type(tinfo->mining_result))->terrain_name);
}
- if ((tinfo->transform_result != T_LAST) && (tinfo->transform_result !=
ttype))
+ if ((tinfo->transform_result != T_NONE) && (tinfo->transform_result !=
ttype))
{
my_snprintf (transtext, sizeof(transtext), transfmt,
(get_tile_type(tinfo->transform_result))->terrain_name);
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 24 Aug 2004 03:23:12 -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 24 Aug 2004 03:23:12 -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);
@@ -1282,7 +1282,7 @@
ttype = map_get_tile(punit->x, punit->y)->terrain;
tinfo = get_tile_type(ttype);
- if ((tinfo->irrigation_result != T_LAST) && (tinfo->irrigation_result !=
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);
}
@@ -1296,7 +1296,7 @@
sz_strlcpy(irrtext, _("Build Irrigation"));
}
- if ((tinfo->mining_result != T_LAST) && (tinfo->mining_result != ttype))
+ if ((tinfo->mining_result != T_NONE) && (tinfo->mining_result != ttype))
{
my_snprintf(mintext, sizeof(mintext), chgfmt,
(get_tile_type(tinfo->mining_result))->terrain_name);
}
@@ -1305,7 +1305,7 @@
sz_strlcpy(mintext, _("Build Mine"));
}
- if ((tinfo->transform_result != T_LAST) && (tinfo->transform_result !=
ttype))
+ if ((tinfo->transform_result != T_NONE) && (tinfo->transform_result !=
ttype))
{
my_snprintf(transtext, sizeof(transtext), chgfmt,
(get_tile_type(tinfo->transform_result))->terrain_name);
}
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 24 Aug 2004 03:23:13 -0000
@@ -99,7 +99,7 @@
static SDL_Surface *pOcean_Tile;
static SDL_Surface *pOcean_Foged_Tile;
-static SDL_Surface *pDithers[T_LAST][4];
+static SDL_Surface *pDithers[MAX_NUM_TERRAINS][4];
static enum {
NORMAL = 0,
@@ -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,
@@ -3257,7 +3257,7 @@
SDL_FillRect(pBuf, NULL, color);
SDL_SetColorKey(pBuf, SDL_SRCCOLORKEY, color);
- for (terrain = T_ARCTIC ; terrain < T_LAST ; terrain++)
+ for (terrain = T_FIRST; terrain < T_COUNT ; terrain++)
{
if (terrain == T_RIVER || is_ocean(terrain) || terrain == T_UNKNOWN)
@@ -3325,10 +3325,10 @@
**************************************************************************/
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++)
+ for (terrain = T_FIRST; terrain < T_COUNT ; terrain++)
{
for(i = 0; i < 4; i++)
{
@@ -3343,9 +3343,9 @@
**************************************************************************/
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++)
+ for (terrain = T_FIRST; terrain < T_COUNT ; terrain++)
{
for(i = 0; i < 4; i++)
{
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 24 Aug 2004 03:23:13 -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/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/helpdlg.c,v
retrieving revision 1.19
diff -u -r1.19 helpdlg.c
--- client/gui-win32/helpdlg.c 18 Aug 2004 04:23:20 -0000 1.19
+++ client/gui-win32/helpdlg.c 24 Aug 2004 03:23:13 -0000
@@ -616,7 +616,7 @@
tile_types[i].irrigation_time);
}
}
- else if (tile_types[i].irrigation_result != T_LAST)
+ else if (tile_types[i].irrigation_result != T_NONE)
{
sprintf (buf, "%s / %d",
tile_types[tile_types[i].irrigation_result].terrain_name,
@@ -634,7 +634,7 @@
tile_types[i].mining_time);
}
}
- else if (tile_types[i].mining_result != T_LAST)
+ else if (tile_types[i].mining_result != T_NONE)
{
sprintf (buf, "%s / %d",
tile_types[tile_types[i].mining_result].terrain_name,
@@ -642,7 +642,7 @@
}
SetWindowText (help_tlabel[3][1], buf);
- if (tile_types[i].transform_result != T_LAST)
+ if (tile_types[i].transform_result != T_NONE)
{
sprintf (buf, "%s / %d",
tile_types[tile_types[i].transform_result].terrain_name,
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 24 Aug 2004 03:23:13 -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"));
@@ -976,7 +976,7 @@
}
ttype = map_get_tile(punit->x, punit->y)->terrain;
tinfo = get_tile_type(ttype);
- if ((tinfo->irrigation_result != T_LAST) && (tinfo->irrigation_result
!= 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);
@@ -986,12 +986,12 @@
{
sz_strlcpy (irrtext, _("Build Farmland"));
}
- if ((tinfo->mining_result != T_LAST) && (tinfo->mining_result != ttype))
+ if ((tinfo->mining_result != T_NONE) && (tinfo->mining_result != ttype))
{
my_snprintf (mintext, sizeof(mintext), chgfmt,
(get_tile_type(tinfo->mining_result))->terrain_name);
}
- if ((tinfo->transform_result != T_LAST) && (tinfo->transform_result !=
ttype))
+ if ((tinfo->transform_result != T_NONE) && (tinfo->transform_result !=
ttype))
{
my_snprintf (transtext, sizeof(transtext), transfmt,
(get_tile_type(tinfo->transform_result))->terrain_name);
Index: client/gui-xaw/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/helpdlg.c,v
retrieving revision 1.50
diff -u -r1.50 helpdlg.c
--- client/gui-xaw/helpdlg.c 18 Aug 2004 04:23:20 -0000 1.50
+++ client/gui-xaw/helpdlg.c 24 Aug 2004 03:23:13 -0000
@@ -1043,7 +1043,7 @@
tile_types[i].irrigation_time);
}
}
- else if (tile_types[i].irrigation_result != T_LAST)
+ else if (tile_types[i].irrigation_result != T_NONE)
{
sprintf (buf, "%s / %d",
tile_types[tile_types[i].irrigation_result].terrain_name,
@@ -1061,7 +1061,7 @@
tile_types[i].mining_time);
}
}
- else if (tile_types[i].mining_result != T_LAST)
+ else if (tile_types[i].mining_result != T_NONE)
{
sprintf (buf, "%s / %d",
tile_types[tile_types[i].mining_result].terrain_name,
@@ -1069,7 +1069,7 @@
}
xaw_set_label (help_terrain_mining_result_time_data, buf);
- if (tile_types[i].transform_result != T_LAST)
+ if (tile_types[i].transform_result != T_NONE)
{
sprintf (buf, "%s / %d",
tile_types[tile_types[i].transform_result].terrain_name,
Index: client/gui-xaw/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/menu.c,v
retrieving revision 1.65
diff -u -r1.65 menu.c
--- client/gui-xaw/menu.c 23 Aug 2004 23:24:45 -0000 1.65
+++ client/gui-xaw/menu.c 24 Aug 2004 03:23:14 -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;
@@ -407,7 +407,7 @@
TEXT_ORDER_CITY_BUILD, NULL);
}
- if ((tinfo->irrigation_result != T_LAST) && (tinfo->irrigation_result !=
ttype)) {
+ if ((tinfo->irrigation_result != T_NONE) && (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);
@@ -421,7 +421,7 @@
TEXT_ORDER_IRRIGATE_IRRIGATE, NULL);
}
- if ((tinfo->mining_result != T_LAST) && (tinfo->mining_result != ttype))
{
+ if ((tinfo->mining_result != T_NONE) && (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);
@@ -430,7 +430,7 @@
TEXT_ORDER_MINE_MINE, NULL);
}
- if ((tinfo->transform_result != T_LAST) && (tinfo->transform_result !=
ttype)) {
+ if ((tinfo->transform_result != T_NONE) && (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);
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 24 Aug 2004 03:23:15 -0000
@@ -370,21 +370,23 @@
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);
spec_gate = impr->spec_gate;
terr_gate = impr->terr_gate;
- if (*spec_gate==S_NO_SPECIAL && *terr_gate==T_LAST) return TRUE;
+ if (*spec_gate == S_NO_SPECIAL && *terr_gate == T_NONE) {
+ return TRUE;
+ }
for (;*spec_gate!=S_NO_SPECIAL;spec_gate++) {
if (map_has_special(pcity->x, pcity->y, *spec_gate) ||
is_special_near_tile(pcity->x,pcity->y,*spec_gate)) return TRUE;
}
- for (;*terr_gate!=T_LAST;terr_gate++) {
+ for (; *terr_gate != T_NONE; terr_gate++) {
if (map_get_terrain(pcity->x,pcity->y) == *terr_gate ||
is_terrain_near_tile(pcity->x,pcity->y,*terr_gate)) return TRUE;
}
@@ -580,7 +582,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 +687,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 +800,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 +920,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 24 Aug 2004 03:23:15 -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/fc_types.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/fc_types.h,v
retrieving revision 1.1
diff -u -r1.1 fc_types.h
--- common/fc_types.h 13 Aug 2004 15:59:12 -0000 1.1
+++ common/fc_types.h 24 Aug 2004 03:23:15 -0000
@@ -19,5 +19,6 @@
* definition in another file */
typedef signed short Continent_id;
+typedef int Terrain_type_id;
#endif /* FC__FC_TYPES_H */
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.148
diff -u -r1.148 game.h
--- common/game.h 16 Aug 2004 15:42:59 -0000 1.148
+++ common/game.h 24 Aug 2004 03:23:15 -0000
@@ -157,6 +157,8 @@
int playable_nation_count;
int styles_count;
+ int terrain_count;
+
int watchtower_extra_vision;
int watchtower_vision;
int allowed_city_names;
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 24 Aug 2004 03:23:15 -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_NONE = 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_NONE 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 24 Aug 2004 03:23:16 -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;
@@ -926,8 +926,7 @@
} else {
map_set_special(x, y, S_IRRIGATION);
}
- }
- else if (result != T_LAST) {
+ } else if (result != T_NONE) {
map_set_terrain(x, y, result);
if (is_ocean(result)) {
clear_infrastructure(x, y);
@@ -945,14 +944,14 @@
***************************************************************/
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;
if (now == result)
map_set_special(x, y, S_MINE);
- else if (result != T_LAST) {
+ else if (result != T_NONE) {
map_set_terrain(x, y, result);
if (is_ocean(result)) {
clear_infrastructure(x, y);
@@ -969,7 +968,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,13 +997,14 @@
***************************************************************/
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;
- if (result != T_LAST)
+ if (result != T_NONE) {
change_terrain(x, y, 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.206
diff -u -r1.206 map.h
--- common/map.h 24 Aug 2004 01:59:43 -0000 1.206
+++ common/map.h 24 Aug 2004 03:23:17 -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;
@@ -105,15 +105,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;
@@ -121,8 +121,8 @@
int clean_pollution_time;
int clean_fallout_time;
- enum tile_terrain_type warmer_wetter_result, warmer_drier_result;
- enum tile_terrain_type cooler_wetter_result, cooler_drier_result;
+ Terrain_type_id warmer_wetter_result, warmer_drier_result;
+ Terrain_type_id cooler_wetter_result, cooler_drier_result;
bv_terrain_flags flags;
@@ -349,11 +349,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);
@@ -403,7 +403,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/nation.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/nation.h,v
retrieving revision 1.28
diff -u -r1.28 nation.h
--- common/nation.h 24 Jul 2004 12:26:05 -0000 1.28
+++ common/nation.h 24 Aug 2004 03:23:17 -0000
@@ -54,7 +54,7 @@
struct city_name {
char* name;
ternary river;
- ternary terrain[T_COUNT];
+ ternary terrain[MAX_NUM_TERRAINS];
};
struct leader {
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.40
diff -u -r1.40 packets.def
--- common/packets.def 20 Aug 2004 20:13:17 -0000 1.40
+++ common/packets.def 24 Aug 2004 03:23:17 -0000
@@ -163,7 +163,7 @@
type CLAUSE = uint8(enum clause_type)
type ACTIVITY = uint8(enum unit_activity)
type EVENT = sint16(enum event_type)
-type TERRAIN = uint8(enum tile_terrain_type)
+type TERRAIN = uint8(Terrain_type_id)
type SPECIAL = uint16(enum tile_special_type)
type SPECIALIST = uint8(enum specialist_type)
type DIPLOMAT_ACTION = uint8(enum diplomat_actions)
@@ -1240,6 +1240,7 @@
UINT8 nation_count;
UINT8 playable_nation_count;
UINT8 style_count;
+ UINT8 terrain_count;
UINT8 borders;
BOOL happyborders;
BOOL slow_invasions; add-cap(slow_invasions)
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 24 Aug 2004 03:23:17 -0000
@@ -24,12 +24,12 @@
#include "support.h"
#include "terrain.h"
-struct tile_type tile_types[T_LAST];
+struct tile_type tile_types[MAX_NUM_TERRAINS];
/***************************************************************
...
***************************************************************/
-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;
@@ -112,7 +112,7 @@
} terrain_type_iterate_end;
die("Reached end of get_flag_terrain!");
- return T_LAST;
+ return T_NONE;
}
/****************************************************************************
@@ -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 24 Aug 2004 03:23:17 -0000
@@ -15,6 +15,8 @@
#include "shared.h"
+#include "fc_types.h"
+
enum special_river_move {
RMV_NORMAL=0, RMV_FAST_STRICT=1, RMV_FAST_RELAXED=2, RMV_FAST_ALWAYS=3
};
@@ -60,16 +62,17 @@
| S_FORTRESS \
| S_AIRBASE)
-/* Changing this breaks savegame and network compatability. */
-enum tile_terrain_type {
- T_ARCTIC, T_DESERT, T_FOREST, T_GRASSLAND, T_HILLS, T_JUNGLE,
- T_MOUNTAINS, T_OCEAN, T_PLAINS, T_UNUSED, T_SWAMP, T_TUNDRA, T_UNKNOWN,
- T_LAST, /* last terrain type */
- T_ANY /* A special flag that matches "any" terrain type. */
-};
-#define T_FIRST (T_ARCTIC)
-#define T_COUNT (T_UNKNOWN)
-#define MAX_NUM_TERRAINS (T_LAST)
+#define T_NONE (-3) /* A special flag meaning no terrain type. */
+#define T_ANY (-2) /* A special flag that matches "any" terrain type. */
+#define T_UNKNOWN (-1) /* An unknown terrain. */
+
+/* The first terrain value and number of base terrains. This is used in
+ * loops. T_COUNT may eventually be turned into a variable. */
+#define T_FIRST (0)
+#define T_COUNT (game.terrain_count)
+
+/* A hard limit on the number of terrains; useful for static arrays. */
+#define MAX_NUM_TERRAINS (MAX_NUM_ITEMS)
/* Must match with terrain_flag_from_str in terrain.c. */
enum terrain_flag_id {
@@ -93,21 +96,21 @@
BV_DEFINE(bv_terrain_flags, TER_MAX);
-extern struct tile_type tile_types[T_LAST];
+extern struct tile_type tile_types[MAX_NUM_TERRAINS];
/* 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 +128,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/unit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v
retrieving revision 1.215
diff -u -r1.215 unit.c
--- common/unit.c 17 Aug 2004 05:13:58 -0000 1.215
+++ common/unit.c 24 Aug 2004 03:23:18 -0000
@@ -865,7 +865,7 @@
&& ((ptile->terrain == type->mining_result
&& !tile_has_special(ptile, S_MINE))
|| (ptile->terrain != type->mining_result
- && type->mining_result != T_LAST
+ && type->mining_result != T_NONE
&& (!is_ocean(ptile->terrain)
|| is_ocean(type->mining_result)
|| can_reclaim_ocean(map_x, map_y))
@@ -895,7 +895,7 @@
&& ((ptile->terrain == type->irrigation_result
&& is_water_adjacent_to_tile(map_x, map_y))
|| (ptile->terrain != type->irrigation_result
- && type->irrigation_result != T_LAST
+ && type->irrigation_result != T_NONE
&& (!is_ocean(ptile->terrain)
|| is_ocean(type->irrigation_result)
|| can_reclaim_ocean(map_x, map_y))
@@ -981,7 +981,7 @@
case ACTIVITY_TRANSFORM:
return (terrain_control.may_transform
- && type->transform_result != T_LAST
+ && type->transform_result != T_NONE
&& ptile->terrain != type->transform_result
&& (!is_ocean(ptile->terrain)
|| is_ocean(type->transform_result)
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 24 Aug 2004 03:23:18 -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 24 Aug 2004 03:23:20 -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
@@ -2070,7 +2070,7 @@
}
while (!is_ocean(improvement_types[impr].terr_gate[i])
- && improvement_types[impr].terr_gate[i] != T_LAST) {
+ && improvement_types[impr].terr_gate[i] != T_NONE) {
i++;
}
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 24 Aug 2004 03:23:21 -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.140
diff -u -r1.140 maphand.c
--- server/maphand.c 24 Aug 2004 01:59:43 -0000 1.140
+++ server/maphand.c 24 Aug 2004 03:23:22 -0000
@@ -73,7 +73,7 @@
k = map_num_tiles();
while(effect > 0 && (k--) > 0) {
- enum tile_terrain_type old, new;
+ Terrain_type_id old, new;
rand_map_pos(&x, &y);
old = map_get_terrain(x, y);
@@ -82,7 +82,7 @@
} else {
new = get_tile_type(old)->warmer_drier_result;
}
- if (new != T_LAST && old != new) {
+ if (new != T_NONE && old != new) {
effect--;
change_terrain(x, y, new);
send_tile_info(NULL, x, y);
@@ -114,7 +114,7 @@
k = map_num_tiles();
while(effect > 0 && (k--) > 0) {
- enum tile_terrain_type old, new;
+ Terrain_type_id old, new;
rand_map_pos(&x, &y);
old = map_get_terrain(x, y);
@@ -123,7 +123,7 @@
} else {
new = get_tile_type(old)->cooler_drier_result;
}
- if (new != T_LAST && old != new) {
+ if (new != T_NONE && old != new) {
effect--;
change_terrain(x, y, new);
send_tile_info(NULL, x, y);
@@ -1291,9 +1291,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 24 Aug 2004 03:23:22 -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.188
diff -u -r1.188 ruleset.c
--- server/ruleset.c 24 Aug 2004 01:59:43 -0000 1.188
+++ server/ruleset.c 24 Aug 2004 03:23:23 -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);
@@ -478,14 +478,14 @@
/**************************************************************************
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"))) {
- return (T_LAST);
+ return T_NONE;
} else if (0 == strcmp(name, "yes")) {
return (tthis);
}
@@ -499,7 +499,7 @@
/* TRANS: message for an obscure ruleset error. */
freelog(LOG_ERROR, _("Unknown terrain %s in entry %s."),
name, tile_types[tthis].terrain_name);
- return T_LAST;
+ return T_NONE;
}
/**************************************************************************
@@ -1183,7 +1183,7 @@
k = 0;
for (j = 0; j < count; j++) {
b->terr_gate[k] = get_terrain_by_name(list[j]);
- if (b->terr_gate[k] >= T_UNKNOWN) {
+ if (b->terr_gate[k] == T_UNKNOWN) {
freelog(LOG_ERROR,
"for %s terr_gate[%d] couldn't match terrain \"%s\" (%s)",
b->name, j, list[j], filename);
@@ -1191,7 +1191,7 @@
k++;
}
}
- b->terr_gate[k] = T_LAST;
+ b->terr_gate[k] = T_NONE;
free(list);
list = secfile_lookup_str_vec(file, &count, "%s.spec_gate", sec[i]);
@@ -1391,14 +1391,14 @@
secfile_lookup_str_default(file, "", "%s.effect%d.aff_terr", sec[i], j);
if (*item != '\0') {
if (0 == strcmp("None", item)) {
- e->aff_terr = T_LAST;
+ e->aff_terr = T_NONE;
} else {
e->aff_terr = get_terrain_by_name(item);
- if (e->aff_terr >= T_UNKNOWN) {
+ if (e->aff_terr == T_UNKNOWN) {
freelog(LOG_ERROR,
"for %s effect[%d].aff_terr couldn't match terrain \"%s\"
(%s)",
b->name, j, item, filename);
- e->aff_terr = T_LAST;
+ e->aff_terr = T_NONE;
problem = TRUE;
}
}
@@ -1999,6 +1999,7 @@
packet.nation_count = game.nation_count;
packet.playable_nation_count = game.playable_nation_count;
packet.style_count = game.styles_count;
+ packet.terrain_count = game.terrain_count;
for(i = 0; i < MAX_NUM_TEAMS; i++) {
sz_strlcpy(packet.team_name[i], team_get_by_id(i)->name);
@@ -2176,7 +2177,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++) {
/*
@@ -2898,7 +2899,7 @@
packet.elem[packet.count] = b->elem[packet.count]; \
}
- T(terr_gate, terr_gate_count, T_LAST);
+ T(terr_gate, terr_gate_count, T_NONE);
T(spec_gate, spec_gate_count, S_NO_SPECIAL);
T(equiv_dupl, equiv_dupl_count, B_LAST);
T(equiv_repl, equiv_repl_count, B_LAST);
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 24 Aug 2004 03:23:23 -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))
@@ -53,7 +53,7 @@
if (contains_special(special, S_IRRIGATION))
assert(get_tile_type(terrain)->irrigation_result == terrain);
- assert(terrain >= T_ARCTIC && terrain < T_UNKNOWN);
+ assert(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.177
diff -u -r1.177 savegame.c
--- server/savegame.c 24 Aug 2004 01:37:18 -0000 1.177
+++ server/savegame.c 24 Aug 2004 03:23:23 -0000
@@ -221,7 +221,7 @@
Dereferences the terrain character. See tile_types[].identifier
example: char2terrain('a') => T_ARCTIC
****************************************************************************/
-static enum tile_terrain_type char2terrain(char ch)
+static Terrain_type_id char2terrain(char ch)
{
if (ch == UNKNOWN_TERRAIN_IDENTIFIER) {
return T_UNKNOWN;
@@ -241,7 +241,7 @@
References the terrain character. See tile_types[].identifier
example: terrain2char(T_ARCTIC) => 'a'
****************************************************************************/
-static char terrain2char(enum tile_terrain_type terr)
+static char terrain2char(Terrain_type_id terr)
{
if (terr == T_UNKNOWN) {
return UNKNOWN_TERRAIN_IDENTIFIER;
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 24 Aug 2004 03:23:24 -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,12 +389,12 @@
{
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) {
+ if (old_terrain != new_terrain && new_terrain != T_NONE) {
/* Irrigation would change the terrain type, clearing the mine
* in the process. Calculate the benefit of doing so. */
if (ptile->city && terrain_has_flag(new_terrain, TER_NO_CITIES)) {
@@ -453,12 +453,12 @@
{
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) {
+ if (old_terrain != new_terrain && new_terrain != T_NONE) {
/* Mining would change the terrain type, clearing the irrigation
* in the process. Calculate the benefit of doing so. */
if (ptile->city && terrain_has_flag(new_terrain, TER_NO_CITIES)) {
@@ -506,12 +506,12 @@
{
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) {
+ if (old_terrain == new_terrain || new_terrain == T_NONE) {
return -1;
}
@@ -563,6 +563,7 @@
int dx[12] = {-1, 0, 1, -1, 1, -1, 0, 1, 0, -2, 2, 0};
int dy[12] = {-1, -1, -1, 0, 0, 1, 1, 1, -2, 0, 0, 2};
struct tile *ptile;
+ struct tile_type *ptype;
bool is_border = IS_BORDER_MAP_POS(map_x, map_y, 2);
assert(special == S_ROAD || special == S_RAILROAD);
@@ -579,12 +580,12 @@
is_slow[i] = FALSE; /* FIXME: should be TRUE? */
} else {
ptile = map_get_tile(x1, y1);
+ ptype = get_tile_type(ptile->terrain);
has_road[i] = tile_has_special(ptile, special);
/* If TRUE, this value indicates that this tile does not need
* a road connector. FIXME: this shouldn't include mountains. */
- is_slow[i] = (ptile->terrain == T_MOUNTAINS
- || is_ocean(ptile->terrain));
+ is_slow[i] = (ptype->road_time == 0 || ptype->road_time > 5);
if (!has_road[i]) {
unit_list_iterate(ptile->units, punit) {
@@ -1236,7 +1237,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 24 Aug 2004 03:23:25 -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))
- [Freeciv-Dev] (PR#9787) RFC: generalized terrain,
Jason Short <=
|
|