Freeciv-3.4
Loading...
Searching...
No Matches
terrain.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 2003 - The Freeciv Project
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* utility */
19#include "fcintl.h"
20#include "log.h" /* fc_assert */
21#include "mem.h" /* free */
22#include "rand.h"
23#include "shared.h"
24#include "string_vector.h"
25#include "support.h"
26
27/* common */
28#include "extras.h"
29#include "game.h"
30#include "map.h"
31#include "rgbcolor.h"
32#include "road.h"
33
34#include "terrain.h"
35
38
39/**********************************************************************/
42void terrains_init(void)
43{
44 int i;
45
46 for (i = 0; i < ARRAY_SIZE(civ_terrains); i++) {
47 int j;
48
49 /* Can't use terrain_by_number here because it does a bounds check. */
52 civ_terrains[i].ruledit_dlg = nullptr;
53 civ_terrains[i].rgb = nullptr;
54 civ_terrains[i].animal = nullptr;
55
56 for (j = 0; j < MAX_EXTRA_TYPES; j++) {
58 }
59 }
60}
61
62/**********************************************************************/
65void terrains_free(void)
66{
67 terrain_type_iterate(pterrain) {
68 if (pterrain->helptext != nullptr) {
69 strvec_destroy(pterrain->helptext);
70 pterrain->helptext = nullptr;
71 }
72 if (pterrain->resources != nullptr) {
73 /* Server allocates this on ruleset loading, client when
74 * ruleset packet is received. */
75 free(pterrain->resources);
76 pterrain->resources = nullptr;
77 }
78 if (pterrain->resource_freq != nullptr) {
79 /* Server allocates this on ruleset loading, client when
80 * ruleset packet is received. */
81 free(pterrain->resource_freq);
82 pterrain->resource_freq = nullptr;
83 }
84 if (pterrain->rgb != nullptr) {
85 /* Server allocates this on ruleset loading, client when
86 * ruleset packet is received. */
87 rgbcolor_destroy(pterrain->rgb);
88 pterrain->rgb = nullptr;
89 }
91}
92
93/**********************************************************************/
97{
98 if (game.control.terrain_count > 0) {
99 return civ_terrains;
100 }
101
102 return nullptr;
103}
104
105/**********************************************************************/
108const struct terrain *terrain_array_last(void)
109{
110 if (game.control.terrain_count > 0) {
112 }
113
114 return nullptr;
115}
116
117/**********************************************************************/
124
125/**********************************************************************/
128char terrain_identifier(const struct terrain *pterrain)
129{
130 fc_assert_ret_val(pterrain, '\0');
131 return pterrain->identifier;
132}
133
134/**********************************************************************/
140Terrain_type_id terrain_index(const struct terrain *pterrain)
141{
142 fc_assert_ret_val(pterrain, -1);
143 return pterrain - civ_terrains;
144}
145
146/**********************************************************************/
150{
151 fc_assert_ret_val(pterrain, -1);
152 return pterrain->item_number;
153}
154
155/**********************************************************************/
159{
161 /* This isn't an error; some T_UNKNOWN callers depend on it. */
162 return nullptr;
163 }
164
165 return &civ_terrains[type];
166}
167
168/**********************************************************************/
173{
175 return T_UNKNOWN;
176 }
177 terrain_type_iterate(pterrain) {
178 if (pterrain->identifier == identifier) {
179 return pterrain;
180 }
182
183 return T_UNKNOWN;
184}
185
186/**********************************************************************/
190{
191 const char *qname = Qn_(name);
192
193 terrain_type_iterate(pterrain) {
194 if (0 == fc_strcasecmp(terrain_rule_name(pterrain), qname)) {
195 return pterrain;
196 }
198
199 return T_UNKNOWN;
200}
201
202/**********************************************************************/
206{
207 terrain_type_iterate(pterrain) {
208 if (0 == strcmp(terrain_name_translation(pterrain), name)) {
209 return pterrain;
210 }
212
213 return T_UNKNOWN;
214}
215
216/**********************************************************************/
221{
222 int num = 0;
223 struct terrain *terr = nullptr;
224
226 if (terrain_has_flag(pterr, flag)) {
227 num++;
228 if (fc_rand(num) == 1) {
229 terr = pterr;
230 }
231 }
233
234 return terr;
235}
236
237/**********************************************************************/
241const char *terrain_name_translation(const struct terrain *pterrain)
242{
243 return name_translation_get(&pterrain->name);
244}
245
246/**********************************************************************/
250const char *terrain_rule_name(const struct terrain *pterrain)
251{
252 return rule_name_get(&pterrain->name);
253}
254
255/**********************************************************************/
258bool terrain_has_resource(const struct terrain *pterrain,
259 const struct extra_type *presource)
260{
261 struct extra_type **r = pterrain->resources;
262
263 while (*r != nullptr) {
264 if (*r == presource) {
265 return TRUE;
266 }
267 r++;
268 }
269
270 return FALSE;
271}
272
273/**********************************************************************/
277{
278 struct resource_type *presource;
279
280 presource = fc_malloc(sizeof(*presource));
281
282 pextra->data.resource = presource;
283
284 presource->self = pextra;
285
286 return presource;
287}
288
289/**********************************************************************/
293{
294 /* Resource structure itself is freed as part of extras destruction. */
295}
296
297/**********************************************************************/
300struct extra_type *resource_extra_get(const struct resource_type *presource)
301{
302 return presource->self;
303}
304
305/**********************************************************************/
309#define variable_adjc_iterate(nmap, center_tile, _tile, card_only) \
310{ \
311 enum direction8 *_tile##_list; \
312 int _tile##_count; \
313 \
314 if (card_only) { \
315 _tile##_list = MAP_CARDINAL_DIRS; \
316 _tile##_count = MAP_NUM_CARDINAL_DIRS; \
317 } else { \
318 _tile##_list = MAP_VALID_DIRS; \
319 _tile##_count = MAP_NUM_VALID_DIRS; \
320 } \
321 adjc_dirlist_iterate(nmap, center_tile, _tile, _tile##_dir, \
322 _tile##_list, _tile##_count) {
323
324#define variable_adjc_iterate_end \
325 } adjc_dirlist_iterate_end; \
326}
327
328/**********************************************************************/
332 const struct tile *ptile,
333 const struct terrain *pterrain,
334 bool check_self)
335{
336 if (pterrain == nullptr) {
337 return FALSE;
338 }
339
341 if (tile_terrain(adjc_tile) == pterrain) {
342 return TRUE;
343 }
345
346 return check_self && ptile->terrain == pterrain;
347}
348
349/**********************************************************************/
353 const struct tile *ptile,
354 const struct terrain *pterrain,
355 bool check_self)
356{
357 if (pterrain == nullptr) {
358 return FALSE;
359 }
360
361 adjc_iterate(nmap, ptile, adjc_tile) {
362 if (tile_terrain(adjc_tile) == pterrain) {
363 return TRUE;
364 }
366
367 return check_self && ptile->terrain == pterrain;
368}
369
370/**********************************************************************/
374 const struct tile *ptile,
375 bool cardinal_only, bool percentage,
377{
378 int count = 0, total = 0;
379
381 struct terrain *pterrain = tile_terrain(adjc_tile);
382
383 if (pterrain->property[prop] > 0) {
384 count++;
385 }
386 total++;
388
389 if (percentage && count > 0) { /* Latter condition avoids div by zero */
390 count = count * 100 / total;
391 }
392
393 return count;
394}
395
396/**********************************************************************/
400 const struct tile *ptile,
401 const struct extra_type *pres,
402 bool check_self)
403{
404 if (pres == nullptr) {
405 return FALSE;
406 }
407
409 if (tile_resource(adjc_tile) == pres) {
410 return TRUE;
411 }
413
414 return check_self && tile_resource(ptile) == pres;
415}
416
417/**********************************************************************/
421 const struct tile *ptile,
422 const struct extra_type *pres,
423 bool check_self)
424{
425 if (pres == nullptr) {
426 return FALSE;
427 }
428
429 adjc_iterate(nmap, ptile, adjc_tile) {
430 if (tile_resource(adjc_tile) == pres) {
431 return TRUE;
432 }
434
435 return check_self && tile_resource(ptile) == pres;
436}
437
438/**********************************************************************/
443 const struct tile *ptile,
444 enum terrain_flag_id flag)
445{
447 struct terrain* pterrain = tile_terrain(adjc_tile);
448
449 if (T_UNKNOWN != pterrain
450 && terrain_has_flag(pterrain, flag)) {
451 return TRUE;
452 }
454
455 return FALSE;
456}
457
458/**********************************************************************/
463 const struct tile *ptile,
464 enum terrain_flag_id flag)
465{
466 adjc_iterate(nmap, ptile, adjc_tile) {
467 struct terrain* pterrain = tile_terrain(adjc_tile);
468
469 if (T_UNKNOWN != pterrain
470 && terrain_has_flag(pterrain, flag)) {
471 return TRUE;
472 }
474
475 return FALSE;
476}
477
478/**********************************************************************/
483 const struct tile *ptile,
484 bool cardinal_only, bool percentage,
485 enum terrain_flag_id flag)
486{
487 int count = 0, total = 0;
488
490 struct terrain *pterrain = tile_terrain(adjc_tile);
491
492 if (T_UNKNOWN != pterrain
493 && terrain_has_flag(pterrain, flag)) {
494 count++;
495 }
496 total++;
498
499 if (percentage && count > 0) { /* Latter condition avoids div by zero */
500 count = count * 100 / total;
501 }
502
503 return count;
504}
505
506/**********************************************************************/
513{
514 static char s[256];
515 char *p;
516 int len;
517
518 s[0] = '\0';
519
520 extra_type_iterate(pextra) {
521 if (pextra->category == ECAT_INFRA
522 && BV_ISSET(extras, extra_index(pextra))) {
523 bool hidden = FALSE;
524
525 extra_type_iterate(top) {
526 int topi = extra_index(top);
527
528 if (BV_ISSET(pextra->hidden_by, topi)
529 && BV_ISSET(extras, topi)) {
530 hidden = TRUE;
531 break;
532 }
534
535 if (!hidden) {
536 cat_snprintf(s, sizeof(s), "%s/", extra_name_translation(pextra));
537 }
538 }
540
541 len = strlen(s);
542 p = s + len - 1;
543 if (len > 0 && *p == '/') {
544 *p = '\0';
545 }
546
547 return s;
548}
549
550/**********************************************************************/
555{
556 /* Semi-arbitrary preference order reflecting previous behavior */
557 static const enum extra_cause prefs[] = {
559 EC_MINE,
560 EC_BASE,
561 EC_ROAD,
562 EC_HUT,
567 EC_NONE
568 };
569 int i;
570
571 for (i = 0; i < ARRAY_SIZE(prefs); i++) {
574 && BV_ISSET(extras, extra_index(pextra))) {
575 return pextra;
576 }
578 }
579
580 return nullptr;
581}
582
583/**********************************************************************/
587{
588 return pterrain->tclass;
589}
590
591/**********************************************************************/
596 const struct tile *ptile,
597 enum terrain_class tclass)
598{
600 struct terrain* pterrain = tile_terrain(adjc_tile);
601
602 if (pterrain != T_UNKNOWN) {
603 if (terrain_type_terrain_class(pterrain) == tclass) {
604 return TRUE;
605 }
606 }
608
609 return FALSE;
610}
611
612/**********************************************************************/
617 const struct tile *ptile,
619{
620 adjc_iterate(nmap, ptile, adjc_tile) {
621 struct terrain* pterrain = tile_terrain(adjc_tile);
622
623 if (pterrain != T_UNKNOWN) {
624 if (terrain_type_terrain_class(pterrain) == tclass) {
625 return TRUE;
626 }
627 }
629
630 return FALSE;
631}
632
633/**********************************************************************/
638 const struct tile *ptile,
639 bool cardinal_only, bool percentage,
641{
642 int count = 0, total = 0;
643
645 struct terrain *pterrain = tile_terrain(adjc_tile);
646
647 if (T_UNKNOWN != pterrain
648 && terrain_type_terrain_class(pterrain) == tclass) {
649 count++;
650 }
651 total++;
653
654 if (percentage && count > 0) { /* Latter condition avoids div by zero */
655 count = count * 100 / total;
656 }
657
658 return count;
659}
660
661/**********************************************************************/
666{
668 return nullptr;
669 }
670
671 return _(terrain_class_name(tclass));
672}
673
674/**********************************************************************/
677bool terrain_can_support_alteration(const struct terrain *pterrain,
679{
680 switch (alter) {
681 case TA_CAN_IRRIGATE:
682 return (pterrain->irrigation_time > 0);
683 case TA_CAN_MINE:
684 return (pterrain->mining_time > 0);
685 case TA_CAN_ROAD:
686 return (pterrain->road_time > 0);
687 case TA_CAN_BASE:
688 return (pterrain->base_time > 0);
689 case TA_CAN_PLACE:
690 return (pterrain->placing_time > 0);
691 default:
692 break;
693 }
694
696
697 return FALSE;
698}
699
700/**********************************************************************/
703int terrain_extra_build_time(const struct terrain *pterrain,
704 enum unit_activity activity,
705 const struct extra_type *tgt)
706{
707 int factor;
708
709 if (tgt != nullptr && tgt->build_time != 0) {
710 /* Extra specific build time */
711 return tgt->build_time;
712 }
713
714 if (tgt == nullptr) {
715 factor = 1;
716 } else {
717 factor = tgt->build_time_factor;
718 }
719
720 /* Terrain and activity specific build time */
721 switch (activity) {
722 case ACTIVITY_BASE:
723 return pterrain->base_time * factor;
725 return pterrain->road_time * factor;
727 return pterrain->irrigation_time * factor;
728 case ACTIVITY_MINE:
729 return pterrain->mining_time * factor;
730 default:
732 return 0;
733 }
734}
735
736/**********************************************************************/
739int terrain_extra_removal_time(const struct terrain *pterrain,
740 enum unit_activity activity,
741 const struct extra_type *tgt)
742{
743 int factor;
744
745 if (tgt->removal_time != 0) {
746 /* Extra specific removal time */
747 return tgt->removal_time;
748 }
749
750 factor = tgt->removal_time_factor;
751
752 /* Terrain and activity specific removal time */
753 switch (activity) {
754 case ACTIVITY_CLEAN:
755 return pterrain->extra_removal_times[extra_index(tgt)] * factor;
756 case ACTIVITY_PILLAGE:
757 return pterrain->pillage_time * factor;
758 default:
760
761 return 0;
762 }
763}
764
765/**********************************************************************/
769{
770 int i;
771
772 for (i = 0; i < MAX_NUM_USER_TER_FLAGS; i++) {
774 }
775}
776
777/**********************************************************************/
781{
782 int i;
783
784 for (i = 0; i < MAX_NUM_USER_TER_FLAGS; i++) {
786 }
787}
788
789/**********************************************************************/
793 const char *helptxt)
794{
795 int tfid = id - TER_USER_1;
796
797 fc_assert_ret(id >= TER_USER_1 && id <= TER_USER_LAST);
798
799 if (user_terrain_flags[tfid].name != nullptr) {
801 user_terrain_flags[tfid].name = nullptr;
802 }
803
804 if (name && name[0] != '\0') {
806 }
807
808 if (user_terrain_flags[tfid].helptxt != nullptr) {
811 }
812
813 if (helptxt && helptxt[0] != '\0') {
815 }
816}
817
818/**********************************************************************/
822{
824 return nullptr;
825 }
826
828}
829
830/**********************************************************************/
834{
835 fc_assert(id >= TER_USER_1 && id <= TER_USER_LAST);
836
838}
#define BV_ISSET(bv, bit)
Definition bitvector.h:86
char * incite_cost
Definition comments.c:76
static struct extra_type extras[MAX_EXTRA_TYPES]
Definition extras.c:31
bool is_extra_removed_by(const struct extra_type *pextra, enum extra_rmcause rmcause)
Definition extras.c:353
const char * extra_name_translation(const struct extra_type *pextra)
Definition extras.c:194
#define extra_type_by_cause_iterate_rev(_cause, _extra)
Definition extras.h:344
#define extra_type_by_cause_iterate_rev_end
Definition extras.h:349
#define extra_type_iterate(_p)
Definition extras.h:315
#define extra_type_iterate_end
Definition extras.h:321
#define extra_index(_e_)
Definition extras.h:183
int Terrain_type_id
Definition fc_types.h:233
#define EC_NONE
Definition fc_types.h:806
#define MAX_EXTRA_TYPES
Definition fc_types.h:50
#define _(String)
Definition fcintl.h:67
#define Qn_(String)
Definition fcintl.h:89
void user_flag_init(struct user_flag *flag)
Definition game.c:832
void user_flag_free(struct user_flag *flag)
Definition game.c:841
struct civ_game game
Definition game.c:62
GType type
Definition repodlgs.c:1313
const char * name
Definition inputfile.c:127
#define fc_assert_ret(condition)
Definition log.h:192
#define fc_assert(condition)
Definition log.h:177
#define fc_assert_ret_val(condition, val)
Definition log.h:195
#define adjc_iterate_end
Definition map.h:430
#define cardinal_adjc_iterate_end
Definition map.h:456
#define adjc_iterate(nmap, center_tile, itr_tile)
Definition map.h:425
#define cardinal_adjc_iterate(nmap, center_tile, itr_tile)
Definition map.h:452
#define FC_FREE(ptr)
Definition mem.h:41
#define fc_strdup(str)
Definition mem.h:43
#define fc_malloc(sz)
Definition mem.h:34
static const char * rule_name_get(const struct name_translation *ptrans)
static const char * name_translation_get(const struct name_translation *ptrans)
int len
Definition packhand.c:128
#define fc_rand(_size)
Definition rand.h:56
void rgbcolor_destroy(struct rgbcolor *prgbcolor)
Definition rgbcolor.c:74
#define ARRAY_SIZE(x)
Definition shared.h:85
void strvec_destroy(struct strvec *psv)
struct packet_ruleset_control control
Definition game.h:83
struct resource_type * resource
Definition extras.h:156
int removal_time
Definition extras.h:120
int build_time_factor
Definition extras.h:119
struct extra_type::@26 data
int removal_time_factor
Definition extras.h:121
int build_time
Definition extras.h:118
struct extra_type * self
Definition terrain.h:56
int placing_time
Definition terrain.h:120
int property[MG_COUNT]
Definition terrain.h:146
struct extra_type ** resources
Definition terrain.h:97
int item_number
Definition terrain.h:76
int road_time
Definition terrain.h:106
struct name_translation name
Definition terrain.h:77
const struct unit_type * animal
Definition terrain.h:130
int pillage_time
Definition terrain.h:125
int mining_time
Definition terrain.h:118
struct rgbcolor * rgb
Definition terrain.h:154
enum terrain_class tclass
Definition terrain.h:90
int extra_removal_times[MAX_EXTRA_TYPES]
Definition terrain.h:128
int irrigation_time
Definition terrain.h:115
int base_time
Definition terrain.h:105
void * ruledit_dlg
Definition terrain.h:79
char identifier
Definition terrain.h:84
bool ruledit_disabled
Definition terrain.h:78
Definition tile.h:50
struct terrain * terrain
Definition tile.h:57
char * name
Definition game.h:74
char * helptxt
Definition game.h:75
int fc_strcasecmp(const char *str0, const char *str1)
Definition support.c:186
int cat_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:986
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
int terrain_extra_removal_time(const struct terrain *pterrain, enum unit_activity activity, const struct extra_type *tgt)
Definition terrain.c:739
void user_terrain_flags_init(void)
Definition terrain.c:768
void terrains_free(void)
Definition terrain.c:65
struct terrain * terrain_by_rule_name(const char *name)
Definition terrain.c:189
bool is_terrain_class_near_tile(const struct civ_map *nmap, const struct tile *ptile, enum terrain_class tclass)
Definition terrain.c:616
char terrain_identifier(const struct terrain *pterrain)
Definition terrain.c:128
Terrain_type_id terrain_count(void)
Definition terrain.c:120
void terrains_init(void)
Definition terrain.c:42
struct extra_type * resource_extra_get(const struct resource_type *presource)
Definition terrain.c:300
int count_terrain_class_near_tile(const struct civ_map *nmap, const struct tile *ptile, bool cardinal_only, bool percentage, enum terrain_class tclass)
Definition terrain.c:637
bool is_terrain_class_card_near(const struct civ_map *nmap, const struct tile *ptile, enum terrain_class tclass)
Definition terrain.c:595
struct terrain * terrain_by_translated_name(const char *name)
Definition terrain.c:205
const char * terrain_class_name_translation(enum terrain_class tclass)
Definition terrain.c:665
int count_terrain_flag_near_tile(const struct civ_map *nmap, const struct tile *ptile, bool cardinal_only, bool percentage, enum terrain_flag_id flag)
Definition terrain.c:482
const char * get_infrastructure_text(bv_extras extras)
Definition terrain.c:512
const char * terrain_flag_id_name_cb(enum terrain_flag_id flag)
Definition terrain.c:821
Terrain_type_id terrain_index(const struct terrain *pterrain)
Definition terrain.c:140
bool is_resource_card_near(const struct civ_map *nmap, const struct tile *ptile, const struct extra_type *pres, bool check_self)
Definition terrain.c:399
const char * terrain_name_translation(const struct terrain *pterrain)
Definition terrain.c:241
#define variable_adjc_iterate(nmap, center_tile, _tile, card_only)
Definition terrain.c:309
struct terrain * terrain_array_first(void)
Definition terrain.c:96
struct terrain * rand_terrain_by_flag(enum terrain_flag_id flag)
Definition terrain.c:220
struct terrain * terrain_by_number(const Terrain_type_id type)
Definition terrain.c:158
bool terrain_can_support_alteration(const struct terrain *pterrain, enum terrain_alteration alter)
Definition terrain.c:677
bool is_terrain_card_near(const struct civ_map *nmap, const struct tile *ptile, const struct terrain *pterrain, bool check_self)
Definition terrain.c:331
const char * terrain_rule_name(const struct terrain *pterrain)
Definition terrain.c:250
bool is_resource_near_tile(const struct civ_map *nmap, const struct tile *ptile, const struct extra_type *pres, bool check_self)
Definition terrain.c:420
void resource_types_free(void)
Definition terrain.c:292
void user_terrain_flags_free(void)
Definition terrain.c:780
enum terrain_class terrain_type_terrain_class(const struct terrain *pterrain)
Definition terrain.c:586
const char * terrain_flag_helptxt(enum terrain_flag_id id)
Definition terrain.c:833
bool terrain_has_resource(const struct terrain *pterrain, const struct extra_type *presource)
Definition terrain.c:258
struct resource_type * resource_type_init(struct extra_type *pextra)
Definition terrain.c:276
bool is_terrain_flag_near_tile(const struct civ_map *nmap, const struct tile *ptile, enum terrain_flag_id flag)
Definition terrain.c:462
struct extra_type * get_preferred_pillage(bv_extras extras)
Definition terrain.c:554
void set_user_terrain_flag_name(enum terrain_flag_id id, const char *name, const char *helptxt)
Definition terrain.c:792
const struct terrain * terrain_array_last(void)
Definition terrain.c:108
static struct terrain civ_terrains[MAX_NUM_TERRAINS]
Definition terrain.c:36
int terrain_extra_build_time(const struct terrain *pterrain, enum unit_activity activity, const struct extra_type *tgt)
Definition terrain.c:703
static struct user_flag user_terrain_flags[MAX_NUM_USER_TER_FLAGS]
Definition terrain.c:37
Terrain_type_id terrain_number(const struct terrain *pterrain)
Definition terrain.c:149
struct terrain * terrain_by_identifier(const char identifier)
Definition terrain.c:172
bool is_terrain_flag_card_near(const struct civ_map *nmap, const struct tile *ptile, enum terrain_flag_id flag)
Definition terrain.c:442
int count_terrain_property_near_tile(const struct civ_map *nmap, const struct tile *ptile, bool cardinal_only, bool percentage, enum mapgen_terrain_property prop)
Definition terrain.c:373
#define variable_adjc_iterate_end
Definition terrain.c:324
bool is_terrain_near_tile(const struct civ_map *nmap, const struct tile *ptile, const struct terrain *pterrain, bool check_self)
Definition terrain.c:352
#define terrain_type_iterate(_p)
Definition terrain.h:266
#define T_UNKNOWN
Definition terrain.h:62
#define TERRAIN_UNKNOWN_IDENTIFIER
Definition terrain.h:88
#define terrain_type_iterate_end
Definition terrain.h:272
#define MAX_NUM_TERRAINS
Definition terrain.h:69
#define terrain_has_flag(terr, flag)
Definition terrain.h:176
#define MAX_NUM_USER_TER_FLAGS
Definition terrain.h:32
#define tile_resource(_tile)
Definition tile.h:103
#define tile_terrain(_tile)
Definition tile.h:115