43 for (i = 0; i < ERM_COUNT; i++) {
50 requirement_vector_init(&(
extras[i].rmreqs));
51 requirement_vector_init(&(
extras[i].appearance_reqs));
52 requirement_vector_init(&(
extras[i].disappearance_reqs));
79 for (i = 0; i <
game.
control.num_extra_types; i++) {
93 for (i = 0; i < ERM_COUNT; i++) {
103 requirement_vector_free(&(
extras[i].rmreqs));
104 requirement_vector_free(&(
extras[i].appearance_reqs));
105 requirement_vector_free(&(
extras[i].disappearance_reqs));
112 if (pextra->hiders !=
nullptr) {
113 extra_type_list_destroy(pextra->hiders);
114 pextra->hiders =
nullptr;
116 if (pextra->bridged !=
nullptr) {
117 extra_type_list_destroy(pextra->bridged);
118 pextra->bridged =
nullptr;
187 if (
name ==
nullptr) {
243 enum extra_cause cause,
247 struct extra_type_list *potential = extra_type_list_new();
255 extra_type_list_append(potential, pextra);
260 options = extra_type_list_size(potential);
263 selected = extra_type_list_get(potential,
fc_rand(options));
266 extra_type_list_destroy(potential);
275 enum extra_cause cause)
279 extra_type_list_append(
caused_by[cause], pextra);
285 struct extra_type_list *
297 enum extra_rmcause rmcause)
301 extra_type_list_append(
removed_by[rmcause], pextra);
308 enum extra_rmcause rmcause)
310 return (pextra->
rmcauses & (1 << rmcause));
353 const struct tile *ptile)
372 const struct player *pplayer,
373 const struct tile *ptile)
394 if (pplayer !=
nullptr
415 const struct player *pplayer,
416 const struct tile *ptile)
423 nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
431 const struct player *pplayer,
432 const struct tile *ptile)
434 if (ptile->
placing !=
nullptr) {
451 if (pcity ==
nullptr ||
city_owner(pcity) != pplayer) {
461 if (punit->activity == act) {
476 const struct unit *punit,
const struct tile *ptile)
493 const struct tile *ptile)
498 if (pcity !=
nullptr) {
526 const struct player *pplayer,
527 const struct tile *ptile)
535 nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
544 const struct unit *punit,
const struct tile *ptile)
552 nullptr,
nullptr,
nullptr, &pextra->
rmreqs,
560 const struct tile *ptile)
599 return are_reqs_active(
nullptr,
nullptr,
nullptr,
nullptr, ptile,
nullptr,
600 nullptr,
nullptr,
nullptr,
nullptr, &pextra->
reqs,
608 const struct tile *ptile)
652 nullptr, ptile,
nullptr,
nullptr,
nullptr,
666 const struct tile *ptile)
675 nullptr, ptile,
nullptr,
nullptr,
nullptr,
688 enum extra_cause cause,
689 const struct player *pplayer,
690 const struct unit *punit)
692 if (cause == EC_IRRIGATION) {
700 if (cause == EC_MINE) {
712 if (punit !=
nullptr) {
733 enum extra_rmcause rmcause,
734 const struct player *pplayer,
735 const struct unit *punit)
737 fc_assert(punit !=
nullptr || pplayer !=
nullptr);
742 if (punit !=
nullptr) {
789 enum extra_flag_id flag)
813 enum extra_flag_id flag)
862 int efid =
id - EF_USER_FLAG_1;
872 if (helptxt && helptxt[0] !=
'\0') {
905 if (pextra1 == pextra2) {
936 & (1 << EC_IRRIGATION | 1 << EC_MINE | 1 << EC_BASE | 1 << EC_ROAD));
946 & (1 << ERM_CLEANPOLLUTION | 1 << ERM_CLEANFALLOUT
947 | 1 << ERM_PILLAGE));
954 const struct action *paction)
964 const struct action *paction)
976 case ACTIVITY_IRRIGATE:
977 return EC_IRRIGATION;
982 case ACTIVITY_GEN_ROAD:
997 case ACTIVITY_PILLAGE:
999 case ACTIVITY_POLLUTION:
1000 return ERM_CLEANPOLLUTION;
1001 case ACTIVITY_FALLOUT:
1002 return ERM_CLEANFALLOUT;
1022 const struct tile *ptile)
1029 ptile,
nullptr,
nullptr,
nullptr,
nullptr,
1037 const struct tile *ptile)
1043 ptile,
nullptr,
nullptr,
nullptr,
nullptr,
1053 const struct tile *ptile)
enum unit_activity action_get_activity(const struct action *paction)
Returns the unit activity this action may cause or ACTIVITY_LAST if the action doesn't result in a un...
void base_types_free()
Free the memory associated with base types.
bool BV_ISSET(const BV &bv, int bit)
struct player * city_owner(const struct city *pcity)
Return the owner of the city.
void user_flag_init(struct user_flag *flag)
Initialize user flag.
void user_flag_free(struct user_flag *flag)
Free user flag.
#define fc_assert_ret(condition)
#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)
static const char * rule_name_get(const struct name_translation *ptrans)
static const char * name_translation_get(const struct name_translation *ptrans)
bool player_knows_techs_with_flag(const struct player *pplayer, enum tech_flag_id flag)
Returns TRUE iff the player knows at least one tech which has the given flag.
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.
struct research * research_get(const struct player *pplayer)
Returns the research structure associated with the player.
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
Returns state of the tech for current research.
bool road_has_flag(const struct road_type *proad, enum road_flag_id flag)
Check if road provides effect.
void road_types_free()
Free the memory associated with road types.
struct packet_ruleset_control control
struct packet_game_info info
struct terrain * irrigation_result
struct terrain * mining_result
struct player * extras_owner
struct extra_type * placing
int fc_strcasecmp(const char *str0, const char *str1)
Compare strings like strcmp(), but ignoring case.
bool terrain_has_resource(const struct terrain *pterrain, const struct extra_type *presource)
Check for resource in terrain resources list.
void resource_types_free()
Free the memory associated with resource types.
#define terrain_has_flag(terr, flag)
void tile_virtual_destroy(struct tile *vtile)
Frees all memory used by the virtual tile, including freeing virtual units in the tile's unit list an...
void tile_remove_extra(struct tile *ptile, const struct extra_type *pextra)
Removes extra from tile if such exist.
struct city * tile_city(const struct tile *ptile)
Return the city on this tile (or nullptr), checking for city center.
struct tile * tile_virtual_new(const struct tile *ptile)
Returns a virtual tile.
#define tile_worked(_tile)
#define tile_terrain(_tile)
#define tile_has_extra(ptile, pextra)
#define tile_owner(_tile)
#define tile_changing_activities_iterate_end
#define tile_changing_activities_iterate(_act_)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
const struct unit_type * unit_type_get(const struct unit *punit)
Return the unit type for this unit.
struct unit_class * unit_class_get(const struct unit *punit)
Returns unit class pointer for a unit.
#define uclass_index(_c_)