16 #define SPECENUM_NAME road_flag_id
17 #define SPECENUM_VALUE0 RF_RIVER
20 #define SPECENUM_VALUE0NAME N_("River")
21 #define SPECENUM_VALUE1 RF_UNRESTRICTED_INFRA
22 #define SPECENUM_VALUE1NAME N_("UnrestrictedInfra")
23 #define SPECENUM_VALUE2 RF_JUMP_FROM
24 #define SPECENUM_VALUE2NAME N_("JumpFrom")
25 #define SPECENUM_VALUE3 RF_JUMP_TO
26 #define SPECENUM_VALUE3NAME N_("JumpTo")
27 #define SPECENUM_COUNT RF_COUNT
28 #define SPECENUM_BITVECTOR bv_road_flags
29 #include "specenum_gen.h"
32 #define SPECENUM_NAME road_move_mode
33 #define SPECENUM_VALUE0 RMM_CARDINAL
34 #define SPECENUM_VALUE0NAME "Cardinal"
35 #define SPECENUM_VALUE1 RMM_RELAXED
36 #define SPECENUM_VALUE1NAME "Relaxed"
37 #define SPECENUM_VALUE2 RMM_FAST_ALWAYS
38 #define SPECENUM_VALUE2NAME "FastAlways"
39 #include "specenum_gen.h"
44 #define SPECLIST_TAG road_type
45 #define SPECLIST_TYPE struct road_type
48 #define road_type_list_iterate(roadlist, proad) \
49 TYPED_LIST_ITERATE(struct road_type, roadlist, proad)
50 #define road_type_list_iterate_end LIST_ITERATE_END
77 #define ROAD_NONE (-1)
101 enum road_flag_id flag);
103 enum road_flag_id flag);
106 const struct tile *ptile);
108 const struct tile *ptile);
110 const struct player *pplayer,
111 const struct tile *ptile);
126 #define road_deps_iterate(_reqs, _dep) \
128 requirement_vector_iterate(_reqs, preq) \
130 if (preq->source.kind == VUT_EXTRA && preq->present \
131 && is_extra_caused_by(preq->source.value.extra, EC_ROAD)) { \
132 struct road_type *_dep = extra_road_get(preq->source.value.extra);
134 #define road_deps_iterate_end \
137 requirement_vector_iterate_end; \
Road_type_id road_number(const struct road_type *proad)
Return the road id.
bool road_has_flag(const struct road_type *proad, enum road_flag_id flag)
Check if road provides effect.
bool is_road_flag_card_near(const struct tile *ptile, enum road_flag_id flag)
Returns TRUE iff any cardinally adjacent tile contains a road with the given flag (does not check pti...
bool is_cardinal_only_road(const struct extra_type *pextra)
Is extra cardinal only road.
bool is_road_flag_near_tile(const struct tile *ptile, enum road_flag_id flag)
Returns TRUE iff any adjacent tile contains a road with the given flag (does not check ptile itself).
enum road_compat road_compat_special(const struct road_type *proad)
Return tile special that used to represent this road type.
int count_river_near_tile(const struct tile *ptile, const struct extra_type *priver)
Count tiles with any river near the tile.
int count_river_type_near_tile(const struct tile *ptile, const struct extra_type *priver, bool percentage)
Count tiles with river of specific type near the tile.
bool road_provides_move_bonus(const struct road_type *proad)
Does road type provide move bonus.
bool player_can_build_road(const struct road_type *proad, const struct player *pplayer, const struct tile *ptile)
Tells if player can build road to tile with suitable unit.
struct road_type * road_by_compat_special(enum road_compat compat)
Return road type represented by given compatibility special, or nullptr if special does not represent...
void road_integrators_cache_init()
Initialize the road integrators cache.
int count_river_type_tile_card(const struct tile *ptile, const struct extra_type *priver, bool percentage)
Count tiles with river of specific type cardinally adjacent to the tile.
Road_type_id road_count()
Return the number of road_types.
void road_type_init(struct extra_type *pextra, int idx)
Initialize road_type structures.
int compare_road_move_cost(const struct extra_type *const *p, const struct extra_type *const *q)
This function is passed to road_type_list_sort() to sort a list of roads in ascending move_cost (fast...
void road_types_free()
Free the memory associated with road types.
bool road_can_be_built(const struct road_type *proad, const struct tile *ptile)
Tells if road can build to tile if all other requirements are met.
struct road_type * road_by_number(Road_type_id id)
Return road type of given id.
struct extra_type * road_extra_get(const struct road_type *proad)
Return extra that road is.
bool can_build_road(struct road_type *proad, const struct unit *punit, const struct tile *ptile)
Tells if unit can build road on tile.
static struct compatibility compat[]
struct requirement_vector first_reqs
enum road_move_mode move_mode
struct extra_type_list * integrators
int tile_incr_const[O_LAST]