94
98
/* Reflect reality; but theoretically could be larger than terrains! */
95
99
#define MAX_NUM_RESOURCES (MAX_NUM_TERRAINS/2)
103
/* Must match with find_terrain_flag_by_rule_name in terrain.c. */
104
enum terrain_flag_id {
105
TER_NO_BARBS, /* No barbarians summoned on this terrain. */
106
TER_NO_POLLUTION, /* This terrain cannot be polluted. */
107
TER_NO_CITIES, /* No cities on this terrain. */
108
TER_STARTER, /* Players will start on this terrain type. */
109
TER_CAN_HAVE_RIVER, /* Terrains with this type can have S_RIVER on them. */
110
TER_UNSAFE_COAST,/*this tile is not safe as coast, (all ocean / ice) */
111
TER_OCEANIC, /* This is an water terrain. */
112
TER_FRESHWATER, /* Fresh water terrain */
115
#define TER_FIRST (TER_NO_BARBS)
116
#define TER_COUNT (TER_LAST)
117
#define TER_MAX 64 /* Changing this breaks network compatability. */
119
BV_DEFINE(bv_terrain_flags, TER_MAX);
121
enum mapgen_terrain_property {
101
#define SPECENUM_NAME terrain_class
102
#define SPECENUM_VALUE0 TC_LAND
103
/* TRANS: terrain class: used adjectivally */
104
#define SPECENUM_VALUE0NAME N_("Land")
105
#define SPECENUM_VALUE1 TC_OCEAN
106
/* TRANS: terrain class: used adjectivally */
107
#define SPECENUM_VALUE1NAME N_("Oceanic")
108
#include "specenum_gen.h"
139
110
/* Types of alterations available to terrain.
140
111
* This enum is only used in the effects system; the relevant information
141
112
* is encoded in other members of the terrain structure. */
142
enum terrain_alteration {
143
TA_CAN_IRRIGATE, /* Can build irrigation without changing terrain */
144
TA_CAN_MINE, /* Can build mine without changing terrain */
145
TA_CAN_ROAD, /* Can build roads and/or railroads */
113
#define SPECENUM_NAME terrain_alteration
114
/* Can build irrigation without changing terrain */
115
#define SPECENUM_VALUE0 TA_CAN_IRRIGATE
116
#define SPECENUM_VALUE0NAME "CanIrrigate"
117
/* Can build mine without changing terrain */
118
#define SPECENUM_VALUE1 TA_CAN_MINE
119
#define SPECENUM_VALUE1NAME "CanMine"
120
/* Can build roads and/or railroads */
121
#define SPECENUM_VALUE2 TA_CAN_ROAD
122
#define SPECENUM_VALUE2NAME "CanRoad"
123
#include "specenum_gen.h"
125
#define SPECENUM_NAME terrain_flag_id
126
/* No barbarians summoned on this terrain. */
127
#define SPECENUM_VALUE0 TER_NO_BARBS
128
#define SPECENUM_VALUE0NAME "NoBarbs"
129
/* This terrain cannot be polluted. */
130
#define SPECENUM_VALUE1 TER_NO_POLLUTION
131
#define SPECENUM_VALUE1NAME "NoPollution"
132
/* No cities on this terrain. */
133
#define SPECENUM_VALUE2 TER_NO_CITIES
134
#define SPECENUM_VALUE2NAME "NoCities"
135
/* Players will start on this terrain type. */
136
#define SPECENUM_VALUE3 TER_STARTER
137
#define SPECENUM_VALUE3NAME "Starter"
138
/* Terrains with this type can have S_RIVER on them. */
139
#define SPECENUM_VALUE4 TER_CAN_HAVE_RIVER
140
#define SPECENUM_VALUE4NAME "CanHaveRiver"
141
/*this tile is not safe as coast, (all ocean / ice) */
142
#define SPECENUM_VALUE5 TER_UNSAFE_COAST
143
#define SPECENUM_VALUE5NAME "UnsafeCoast"
144
/* This is an water terrain. */
145
#define SPECENUM_VALUE6 TER_OCEANIC
146
#define SPECENUM_VALUE6NAME "Oceanic"
147
/* Fresh water terrain */
148
#define SPECENUM_VALUE7 TER_FRESHWATER
149
#define SPECENUM_VALUE7NAME "FreshWater"
150
#include "specenum_gen.h"
152
#define TER_MAX 64 /* Changing this breaks network compatability. */
154
BV_DEFINE(bv_terrain_flags, TER_MAX);
156
#define SPECENUM_NAME mapgen_terrain_property
157
#define SPECENUM_VALUE0 MG_MOUNTAINOUS
158
#define SPECENUM_VALUE0NAME "mountainous"
159
#define SPECENUM_VALUE1 MG_GREEN
160
#define SPECENUM_VALUE1NAME "green"
161
#define SPECENUM_VALUE2 MG_FOLIAGE
162
#define SPECENUM_VALUE2NAME "foliage"
163
#define SPECENUM_VALUE3 MG_TROPICAL
164
#define SPECENUM_VALUE3NAME "tropical"
165
#define SPECENUM_VALUE4 MG_TEMPERATE
166
#define SPECENUM_VALUE4NAME "temperate"
167
#define SPECENUM_VALUE5 MG_COLD
168
#define SPECENUM_VALUE5NAME "cold"
169
#define SPECENUM_VALUE6 MG_FROZEN
170
#define SPECENUM_VALUE6NAME "frozen"
171
#define SPECENUM_VALUE7 MG_WET
172
#define SPECENUM_VALUE7NAME "wet"
173
#define SPECENUM_VALUE8 MG_DRY
174
#define SPECENUM_VALUE8NAME "dry"
175
#define SPECENUM_VALUE9 MG_OCEAN_DEPTH
176
#define SPECENUM_VALUE9NAME "ocean_depth"
177
#define SPECENUM_COUNT MG_COUNT
178
#include "specenum_gen.h"
150
181
* This struct gives data about each terrain type. There are many ways
217
248
struct terrain *terrain_by_number(const Terrain_type_id type);
219
struct terrain *find_terrain_by_identifier(const char identifier);
220
struct terrain *find_terrain_by_rule_name(const char *name);
221
struct terrain *find_terrain_by_translated_name(const char *name);
250
struct terrain *terrain_by_identifier(const char identifier);
251
struct terrain *terrain_by_rule_name(const char *name);
252
struct terrain *terrain_by_translated_name(const char *name);
222
253
struct terrain *rand_terrain_by_flag(enum terrain_flag_id flag);
224
255
char terrain_identifier(const struct terrain *pterrain);
225
256
const char *terrain_rule_name(const struct terrain *pterrain);
226
const char *terrain_name_translation(struct terrain *pterrain);
257
const char *terrain_name_translation(const struct terrain *pterrain);
228
259
/* Functions to operate on a terrain flag. */
229
enum terrain_flag_id find_terrain_flag_by_rule_name(const char *s);
230
260
#define terrain_has_flag(terr, flag) BV_ISSET((terr)->flags, flag)
232
262
int terrains_by_flag(enum terrain_flag_id flag, struct terrain **buffer, int bufsize);