48 struct extra_type_list *
roads;
52 if (
roads ==
nullptr || id < 0 || id >= extra_type_list_size(
roads)) {
87 requirement_vector_init(&proad->first_reqs);
90 proad->integrators =
nullptr;
105 extra_type_list_append(proad->
integrators, pextra);
111 extra_type_list_append(proad->
integrators, oextra);
174 const struct tile *ptile)
198 const struct player *pplayer,
199 const struct unit *punit,
200 const struct tile *ptile)
205 if (punit ==
nullptr) {
211 if (requirement_vector_size(&proad->
first_reqs) > 0) {
212 bool beginning =
true;
246 ptile, punit, utype,
nullptr,
nullptr,
nullptr,
254 punit, utype,
nullptr,
nullptr,
nullptr,
262 const struct player *pplayer,
263 const struct tile *ptile)
276 const struct tile *ptile)
300 }
else if (priver !=
nullptr &&
tile_has_extra(adjc_tile, priver)) {
332 count = count * 100 / std::max(total, 1);
359 count = count * 100 / std::max(1, total);
bool BV_ISSET(const BV &bv, int bit)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define cardinal_adjc_iterate_end
#define adjc_iterate(nmap, center_tile, itr_tile)
#define cardinal_adjc_iterate(nmap, center_tile, itr_tile)
bool are_reqs_active(const struct player *target_player, const struct player *other_player, const struct city *target_city, const struct impr_type *target_building, const struct tile *target_tile, const struct unit *target_unit, const struct unit_type *target_unittype, const struct output_type *target_output, const struct specialist *target_specialist, const struct action *target_action, const struct requirement_vector *reqs, const enum req_problem_type prob_type, const enum vision_layer vision_layer, const enum national_intelligence nintel)
Checks the requirement(s) to see if they are active on the given target.
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.
static bool are_road_reqs_fulfilled(const struct road_type *proad, const struct player *pplayer, const struct unit *punit, const struct tile *ptile)
Tells if player and optionally unit have road building requirements fulfilled.
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 packet_ruleset_control control
struct requirement_vector first_reqs
enum road_move_mode move_mode
struct extra_type_list * integrators
bool tile_has_river(const struct tile *ptile)
Tile has any river type.
bool tile_has_road(const struct tile *ptile, const struct road_type *proad)
Returns TRUE if the given tile has a road of given type on it.
#define tile_terrain(_tile)
#define tile_has_extra(ptile, pextra)
#define tile_owner(_tile)
const struct unit_type * unit_type_get(const struct unit *punit)
Return the unit type for this unit.