![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include "fcintl.h"#include "log.h"#include "shared.h"#include "support.h"#include "game.h"#include "victory.h"#include "improvement.h"
Include dependency graph for improvement.cpp:Go to the source code of this file.
Functions | |
| void | improvements_init () |
| Initialize building structures. More... | |
| static void | improvement_free (struct impr_type *p) |
| Frees the memory associated with this improvement. More... | |
| void | improvements_free () |
| Frees the memory associated with all improvements. More... | |
| void | improvement_feature_cache_init () |
| Cache features of the improvement. More... | |
| struct impr_type * | improvement_array_first () |
| Return the first item of improvements. More... | |
| const struct impr_type * | improvement_array_last () |
| Return the last item of improvements. More... | |
| Impr_type_id | improvement_count () |
| Return the number of improvements. More... | |
| Impr_type_id | improvement_index (const struct impr_type *pimprove) |
| Return the improvement index. More... | |
| Impr_type_id | improvement_number (const struct impr_type *pimprove) |
| Return the improvement index. More... | |
| struct impr_type * | improvement_by_number (const Impr_type_id id) |
| Returns the improvement type for the given index/ID. More... | |
| const struct impr_type * | valid_improvement (const struct impr_type *pimprove) |
| Returns pointer when the improvement_type "exists" in this game, returns nullptr otherwise. More... | |
| const char * | improvement_name_translation (const struct impr_type *pimprove) |
| Return the (translated) name of the given improvement. More... | |
| const char * | improvement_rule_name (const struct impr_type *pimprove) |
| Return the (untranslated) rule name of the improvement. More... | |
| int | impr_base_build_shield_cost (const struct impr_type *pimprove) |
| Returns the base number of shields it takes to build this improvement. More... | |
| int | impr_estimate_build_shield_cost (const struct player *pplayer, const struct tile *ptile, const struct impr_type *pimprove) |
| Returns estimate of the number of shields it takes to build this improvement. More... | |
| int | impr_build_shield_cost (const struct city *pcity, const struct impr_type *pimprove) |
| Returns the number of shields it takes to build this improvement. More... | |
| int | impr_buy_gold_cost (const struct city *pcity, const struct impr_type *pimprove, int shields_in_stock) |
| Returns the amount of gold it takes to rush this improvement. More... | |
| int | impr_sell_gold (const struct impr_type *pimprove) |
| Returns the amount of gold received when this improvement is sold. More... | |
| bool | is_wonder (const struct impr_type *pimprove) |
| Returns whether improvement is some kind of wonder. More... | |
| struct impr_type * | improvement_by_translated_name (const char *name) |
| Does a linear search of improvement_types[].name.translated Returns nullptr when none match. More... | |
| struct impr_type * | improvement_by_rule_name (const char *name) |
| Does a linear search of improvement_types[].name.vernacular Returns nullptr when none match. More... | |
| bool | improvement_has_flag (const struct impr_type *pimprove, enum impr_flag_id flag) |
| Return TRUE if the impr has this flag otherwise FALSE. More... | |
| bool | is_improvement_visible (const struct impr_type *pimprove) |
| Return TRUE if the improvement should be visible to others without spying. More... | |
| bool | can_improvement_go_obsolete (const struct impr_type *pimprove) |
| Return TRUE if the improvement can ever go obsolete. More... | |
| bool | improvement_obsolete (const struct player *pplayer, const struct impr_type *pimprove, const struct city *pcity) |
| Returns TRUE if the improvement or wonder is obsolete. More... | |
| static bool | impr_provides_buildable_units (const struct city *pcity, const struct impr_type *pimprove) |
| Returns TRUE iff improvement provides units buildable in city. More... | |
| static bool | impr_provides_buildable_extras (const struct city *pcity, const struct impr_type *pimprove) |
| Returns TRUE iff improvement provides extras buildable in city. More... | |
| static bool | impr_prevents_disaster (const struct city *pcity, const struct impr_type *pimprove) |
| Returns TRUE iff improvement prevents a disaster in city. More... | |
| static bool | impr_protects_vs_actions (const struct city *pcity, const struct impr_type *pimprove) |
| Returns TRUE iff improvement protects against an action on the city FIXME: This is prone to false positives: for example, if one requires a special tech or unit to perform an action, and no other player has or can gain that tech or unit, protection is still claimed. More... | |
| static bool | improvement_has_side_effects (const struct city *pcity, const struct impr_type *pimprove) |
| Check if an improvement has side effects for a city. More... | |
| static bool | improvement_has_effects (const struct city *pcity, const struct impr_type *pimprove) |
| Returns TRUE iff improvement provides some effect (good or bad). More... | |
| bool | is_improvement_productive (const struct city *pcity, const struct impr_type *pimprove) |
| Returns TRUE if an improvement in a city is productive, in some way. More... | |
| bool | is_improvement_redundant (const struct city *pcity, const struct impr_type *pimprove) |
| Returns TRUE if an improvement in a city is redundant, that is, the city wouldn't lose anything by losing the improvement, or gain anything by building it. More... | |
| bool | can_player_build_improvement_direct (const struct player *p, const struct impr_type *pimprove) |
| Whether player can build given building somewhere, ignoring whether it is obsolete. More... | |
| bool | can_player_build_improvement_now (const struct player *p, struct impr_type *pimprove) |
| Whether player can build given building somewhere immediately. More... | |
| bool | can_player_build_improvement_later (const struct player *p, const struct impr_type *pimprove) |
| Whether player can eventually build given building somewhere – i.e., returns TRUE if building is available with current tech OR will be available with future tech. More... | |
| bool | is_great_wonder (const struct impr_type *pimprove) |
| Is this building a great wonder? More... | |
| bool | is_small_wonder (const struct impr_type *pimprove) |
| Is this building a small wonder? More... | |
| bool | is_improvement (const struct impr_type *pimprove) |
| Is this building a regular improvement? More... | |
| bool | is_special_improvement (const struct impr_type *pimprove) |
| Returns TRUE if this is a "special" improvement. More... | |
| void | wonder_built (const struct city *pcity, const struct impr_type *pimprove) |
| Build a wonder in the city. More... | |
| void | wonder_destroyed (const struct city *pcity, const struct impr_type *pimprove) |
| Remove a wonder from a city and destroy it if it's a great wonder. More... | |
| bool | wonder_is_lost (const struct player *pplayer, const struct impr_type *pimprove) |
| Returns whether the player has lost this wonder after having owned it (small or great). More... | |
| bool | wonder_is_built (const struct player *pplayer, const struct impr_type *pimprove) |
| Returns whether the player is currently in possession of this wonder (small or great) and it hasn't been just built this turn. More... | |
| struct city * | city_from_wonder (const struct player *pplayer, const struct impr_type *pimprove) |
| Get the world city with this wonder (small or great). More... | |
| bool | great_wonder_is_built (const struct impr_type *pimprove) |
| Returns whether this wonder is currently built. More... | |
| bool | great_wonder_is_destroyed (const struct impr_type *pimprove) |
| Returns whether this wonder has been destroyed. More... | |
| bool | great_wonder_is_available (const struct impr_type *pimprove) |
| Returns whether this wonder can be currently built. More... | |
| struct city * | city_from_great_wonder (const struct impr_type *pimprove) |
| Get the world city with this great wonder. More... | |
| struct player * | great_wonder_owner (const struct impr_type *pimprove) |
| Get the player owning this small wonder. More... | |
| struct city * | city_from_small_wonder (const struct player *pplayer, const struct impr_type *pimprove) |
| Get the player city with this small wonder. More... | |
| bool | can_sell_building (const struct impr_type *pimprove) |
| Return TRUE iff the improvement can be sold. More... | |
| bool | can_city_sell_building (const struct city *pcity, const struct impr_type *pimprove) |
| Return TRUE iff the city can sell the given improvement. More... | |
| enum test_result | test_player_sell_building_now (struct player *pplayer, const city *pcity, const struct impr_type *pimprove) |
| Return TRUE iff the player can sell the given improvement from city. More... | |
| const struct impr_type * | improvement_replacement (const struct impr_type *pimprove) |
| Try to find a sensible replacement building, based on other buildings that may have caused this one to become obsolete. More... | |
Variables | |
| static struct impr_type | improvement_types [B_LAST] |
| All the city improvements: Use improvement_by_number(id) to access the array. More... | |
Return TRUE iff the city can sell the given improvement.
Definition at line 997 of file improvement.cpp.
Referenced by can_city_sell_universal(), city_balance_treasury_buildings(), city_landlocked_sell_coastal_improvements(), dai_city_sell_noncritical(), do_sell_building(), player_balance_treasury_units_and_buildings(), remove_obsolete_buildings_city(), and try_to_sell_stuff().
| bool can_improvement_go_obsolete | ( | const struct impr_type * | pimprove | ) |
Return TRUE if the improvement can ever go obsolete.
Can be used for buildings or wonders.
Definition at line 381 of file improvement.cpp.
Referenced by dai_can_requirement_be_met_in_city(), and req_text_insert().
| bool can_player_build_improvement_direct | ( | const struct player * | p, |
| const struct impr_type * | pimprove | ||
| ) |
Whether player can build given building somewhere, ignoring whether it is obsolete.
Definition at line 614 of file improvement.cpp.
Referenced by can_city_build_improvement_direct(), can_player_build_improvement_now(), can_player_build_unit_direct(), dai_wants_defender_against(), and dai_wants_role_unit().
| bool can_player_build_improvement_later | ( | const struct player * | p, |
| const struct impr_type * | pimprove | ||
| ) |
Whether player can eventually build given building somewhere – i.e., returns TRUE if building is available with current tech OR will be available with future tech.
Returns FALSE if building is obsolete.
Definition at line 691 of file improvement.cpp.
Referenced by ba_human_wants(), can_city_build_improvement_later(), collect_eventually_buildable_targets(), and dai_build_adv_adjust().
Whether player can build given building somewhere immediately.
Returns FALSE if building is obsolete.
Definition at line 674 of file improvement.cpp.
Referenced by collect_eventually_buildable_targets().
| bool can_sell_building | ( | const struct impr_type * | pimprove | ) |
Return TRUE iff the improvement can be sold.
Definition at line 989 of file improvement.cpp.
Referenced by eco_report::selection_changed().
Get the world city with this great wonder.
This doesn't always success on the client side.
Definition at line 926 of file improvement.cpp.
Referenced by calc_civ_score(), found_new_tech(), handle_edit_city(), and report_wonders_of_the_world().
| struct city* city_from_small_wonder | ( | const struct player * | pplayer, |
| const struct impr_type * | pimprove | ||
| ) |
Get the player city with this small wonder.
Definition at line 974 of file improvement.cpp.
Referenced by base_want(), build_free_small_wonders(), and handle_edit_city().
Get the world city with this wonder (small or great).
This doesn't always succeed on the client side, and even when it does, it may return an "invisible" city whose members are unexpectedly nullptr; take care.
Definition at line 845 of file improvement.cpp.
Referenced by city_from_great_wonder(), city_from_small_wonder(), and num_continent_buildings().
| bool great_wonder_is_available | ( | const struct impr_type * | pimprove | ) |
Returns whether this wonder can be currently built.
Definition at line 914 of file improvement.cpp.
Referenced by can_player_build_improvement_direct(), can_player_build_improvement_later(), city_improvement_name_translation(), and city_turns_to_build().
| bool great_wonder_is_built | ( | const struct impr_type * | pimprove | ) |
Returns whether this wonder is currently built.
Definition at line 888 of file improvement.cpp.
Referenced by can_player_build_unit_direct(), num_world_buildings(), and num_world_buildings_total().
| bool great_wonder_is_destroyed | ( | const struct impr_type * | pimprove | ) |
Returns whether this wonder has been destroyed.
Definition at line 903 of file improvement.cpp.
Referenced by can_player_build_unit_direct(), city_improvement_name_translation(), num_world_buildings_total(), report_wonders_of_the_world(), and sg_save_players().
Get the player owning this small wonder.
This doesn't always success on the client side.
Definition at line 958 of file improvement.cpp.
Referenced by can_player_build_unit_direct().
| int impr_base_build_shield_cost | ( | const struct impr_type * | pimprove | ) |
Returns the base number of shields it takes to build this improvement.
This one does not take city specific bonuses in to account.
Definition at line 233 of file improvement.cpp.
Referenced by help_widget::set_topic_building().
Returns the number of shields it takes to build this improvement.
Definition at line 263 of file improvement.cpp.
Referenced by adjust_improvement_wants_by_effects(), city_build_building(), city_gold_worth(), city_incite_cost(), city_migration_score(), city_turn_notify(), dai_war_desire(), get_tooltip_improvement(), impr_buy_gold_cost(), name_and_sort_items(), universal_build_shield_cost(), and city_dialog::update_improvements().
| int impr_buy_gold_cost | ( | const struct city * | pcity, |
| const struct impr_type * | pimprove, | ||
| int | shields_in_stock | ||
| ) |
Returns the amount of gold it takes to rush this improvement.
Definition at line 277 of file improvement.cpp.
Referenced by city_production_buy_gold_cost(), military_advisor_choose_build(), and wonder_benefit().
| int impr_estimate_build_shield_cost | ( | const struct player * | pplayer, |
| const struct tile * | ptile, | ||
| const struct impr_type * | pimprove | ||
| ) |
Returns estimate of the number of shields it takes to build this improvement.
pplayer and ptile can be nullptr, but that might reduce quality of the estimate.
Definition at line 245 of file improvement.cpp.
Referenced by get_tooltip_improvement().
|
static |
Returns TRUE iff improvement prevents a disaster in city.
Definition at line 467 of file improvement.cpp.
Referenced by improvement_has_side_effects().
|
static |
Returns TRUE iff improvement protects against an action on the city FIXME: This is prone to false positives: for example, if one requires a special tech or unit to perform an action, and no other player has or can gain that tech or unit, protection is still claimed.
Definition at line 493 of file improvement.cpp.
Referenced by improvement_has_side_effects().
|
static |
Returns TRUE iff improvement provides extras buildable in city.
Definition at line 438 of file improvement.cpp.
Referenced by improvement_has_side_effects().
|
static |
Returns TRUE iff improvement provides units buildable in city.
Definition at line 415 of file improvement.cpp.
Referenced by improvement_has_side_effects().
| int impr_sell_gold | ( | const struct impr_type * | pimprove | ) |
Returns the amount of gold received when this improvement is sold.
Definition at line 308 of file improvement.cpp.
Referenced by city_gold_worth(), city_landlocked_sell_coastal_improvements(), dai_city_sell_noncritical(), do_sell_building(), freeciv::improvement_seller::operator()(), really_handle_city_sell(), remove_obsolete_buildings_city(), and sell_all_improvements().
| struct impr_type* improvement_array_first | ( | ) |
Return the first item of improvements.
Definition at line 128 of file improvement.cpp.
| const struct impr_type* improvement_array_last | ( | ) |
Return the last item of improvements.
Definition at line 139 of file improvement.cpp.
| struct impr_type* improvement_by_number | ( | const Impr_type_id | id | ) |
Returns the improvement type for the given index/ID.
Returns nullptr for an out-of-range index.
Definition at line 177 of file improvement.cpp.
Referenced by tab_building::add_now2(), freeciv::improvement_seller::add_to_menu(), adjust_ai_unit_choice(), api_find_building_type(), building_has_effect(), city_build_free_buildings(), freeciv::upkeep_widget::contextMenuEvent(), diplomat_sabotage(), city_widget::display_list_menu(), do_unit_strike_city_building(), handle_city_sell(), handle_ruleset_building(), helptext_building(), helptext_nation(), load_building_names(), load_ruleset_buildings(), military_advisor_choose_build(), plr_widget::nation_selected(), freeciv::improvement_seller::operator()(), package_player_info(), save_building_list(), eco_report::sell_buildings(), eco_report::sell_redundant(), sg_load_player_unit(), unit_order_list_is_sane(), and universal_value_initial().
| struct impr_type* improvement_by_rule_name | ( | const char * | name | ) |
Does a linear search of improvement_types[].name.vernacular Returns nullptr when none match.
Definition at line 343 of file improvement.cpp.
Referenced by api_find_building_type_by_name(), tab_building::initialize_new_bldg(), lookup_building(), lookup_building_list(), tab_building::select_bldg(), sg_load_player_city(), sg_load_player_main(), sg_load_player_vision_city(), sg_load_players_basic(), and universal_by_number().
| struct impr_type* improvement_by_translated_name | ( | const char * | name | ) |
Does a linear search of improvement_types[].name.translated Returns nullptr when none match.
Definition at line 326 of file improvement.cpp.
Referenced by help_dialog::make_tree(), and help_widget::set_topic_building().
| Impr_type_id improvement_count | ( | ) |
Return the number of improvements.
Definition at line 150 of file improvement.cpp.
Referenced by collect_production_targets(), get_req_source_effects(), handle_ruleset_building(), improvement_by_number(), plr_widget::nation_selected(), package_player_info(), popup_info_text(), sg_save_player_cities(), sg_save_player_main(), sg_save_player_vision(), sg_save_players(), and sg_save_savefile().
| void improvement_feature_cache_init | ( | ) |
Cache features of the improvement.
Definition at line 77 of file improvement.cpp.
Referenced by handle_rulesets_ready(), and load_rulesetdir().
|
static |
Frees the memory associated with this improvement.
Definition at line 57 of file improvement.cpp.
Referenced by improvements_free().
|
static |
Returns TRUE iff improvement provides some effect (good or bad).
Definition at line 539 of file improvement.cpp.
Referenced by is_improvement_productive().
| bool improvement_has_flag | ( | const struct impr_type * | pimprove, |
| enum impr_flag_id | flag | ||
| ) |
Return TRUE if the impr has this flag otherwise FALSE.
Definition at line 361 of file improvement.cpp.
Referenced by adjust_improvement_wants_by_effects(), apply_disaster(), ba_human_wants(), build_free_small_wonders(), city_build_free_buildings(), city_can_buy(), city_production_has_flag(), dai_build_adv_adjust(), get_tooltip(), helptext_building(), impr_buy_gold_cost(), is_improvement_productive(), is_improvement_redundant(), is_improvement_visible(), name_and_sort_items(), city_production_delegate::paint(), city_production_model::populate(), rs_buildings(), save_buildings_ruleset(), city_widget::select_building_something(), should_force_recalc(), target_get_section(), and city_dialog::update_improvements().
|
static |
Check if an improvement has side effects for a city.
Side effects are any benefits that accrue that are not tracked by the effects system.
Note that this function will always return FALSE if the improvement does not currently provide a benefit to the city (for example, if the improvement has not yet been built, or another city benefits from the improvement in this city (i.e. Wonders)).
Definition at line 523 of file improvement.cpp.
Referenced by is_improvement_productive(), and is_improvement_redundant().
| Impr_type_id improvement_index | ( | const struct impr_type * | pimprove | ) |
Return the improvement index.
Currently same as improvement_number(), paired with improvement_count() indicates use as an array index.
Definition at line 158 of file improvement.cpp.
Referenced by adjust_improvement_wants_by_effects(), adv_data_city_impr_calc(), ba_human_wants(), base_want(), build_free_small_wonders(), building_advisor_choose(), city_add_improvement(), city_from_great_wonder(), city_from_wonder(), city_has_building(), city_production_caravan_shields_init(), city_production_gets_caravan_shields(), city_remove_improvement(), dai_build_adv_adjust(), dai_build_adv_override(), dai_can_requirement_be_met_in_city(), dai_choose_help_wonder(), dai_city_want(), get_building_sprite(), great_wonder_is_available(), great_wonder_is_built(), great_wonder_is_destroyed(), great_wonder_owner(), handle_city_info(), handle_city_sabotage_list(), handle_city_short_info(), initialize_globals(), package_city(), tab_building::refresh(), remove_city(), sg_load_player_main(), sg_load_player_vision_city(), sg_load_players_basic(), sg_save_player_cities(), sg_save_player_main(), sg_save_player_vision(), sg_save_players(), sg_save_savefile(), spy_send_sabotage_list(), tileset_setup_impr_type(), transfer_city(), update_dumb_city(), update_improvement_from_packet(), wonder_is_built(), and wonder_is_lost().
| const char* improvement_name_translation | ( | const struct impr_type * | pimprove | ) |
Return the (translated) name of the given improvement.
You don't have to free the return pointer.
Definition at line 215 of file improvement.cpp.
Referenced by api_methods_building_type_name_translation(), apply_disaster(), boot_help_texts(), build_free_small_wonders(), city_build_building(), city_global_turn_notify(), city_improvement_name_translation(), city_increase_size(), city_landlocked_sell_coastal_improvements(), city_turn_notify(), cityrep_buy(), freeciv::upkeep_widget::contextMenuEvent(), go_act_menu::create(), dai_city_sell_noncritical(), diplomat_sabotage(), city_widget::display_list_menu(), do_nuke_tile(), do_unit_strike_city_building(), found_new_tech(), get_tooltip_improvement(), handle_edit_city(), helptext_building(), helptext_nation(), improvement_by_translated_name(), insert_allows(), manual_command(), research_diagram::mousePressEvent(), plr_widget::nation_selected(), city_production_delegate::paint(), city_production_model::populate(), popup_info_text(), really_handle_city_buy(), really_handle_city_sell(), remove_obsolete_buildings_city(), report_wonders_of_the_world(), req_text_insert(), research_tech_lost(), sanity_check_req_individual(), sell_all_improvements(), eco_report::sell_buildings(), sell_random_building(), eco_report::sell_redundant(), help_widget::set_topic_tech(), universal_name_translation(), eco_report::update_report(), and upgrade_building_prod().
| Impr_type_id improvement_number | ( | const struct impr_type * | pimprove | ) |
Return the improvement index.
Definition at line 167 of file improvement.cpp.
Referenced by building_has_effect(), cid_encode(), city_from_great_wonder(), city_from_wonder(), go_act_menu::create(), dai_action_choose_sub_tgt_unit_vs_city(), dai_find_source_building(), diplomat_sabotage(), city_widget::display_list_menu(), handle_edit_city(), load_ruleset_units(), lookup_building_list(), popup_sabotage_dialog(), freeciv::upkeep_widget::refresh(), sell_all_improvements(), eco_report::sell_buildings(), eco_report::sell_redundant(), send_ruleset_buildings(), universal_number(), wonder_built(), wonder_destroyed(), and wonder_set_build_turn().
| bool improvement_obsolete | ( | const struct player * | pplayer, |
| const struct impr_type * | pimprove, | ||
| const struct city * | pcity | ||
| ) |
Returns TRUE if the improvement or wonder is obsolete.
Definition at line 389 of file improvement.cpp.
Referenced by can_city_build_improvement_now(), can_player_build_improvement_later(), can_player_build_improvement_now(), city_gold_worth(), city_improvement_name_translation(), dai_can_requirement_be_met_in_city(), dai_war_desire(), improvement_has_effects(), is_improvement_productive(), is_improvement_redundant(), and remove_obsolete_buildings_city().
Try to find a sensible replacement building, based on other buildings that may have caused this one to become obsolete.
Definition at line 1034 of file improvement.cpp.
Referenced by building_upgrades_to().
| const char* improvement_rule_name | ( | const struct impr_type * | pimprove | ) |
Return the (untranslated) rule name of the improvement.
You don't have to free the return pointer.
Definition at line 224 of file improvement.cpp.
Referenced by adjust_improvement_wants_by_effects(), api_methods_building_type_rule_name(), ba_human_wants(), building_advisor_choose(), choose_build_target(), city_from_great_wonder(), city_from_wonder(), city_production_caravan_shields_init(), city_remove_improvement(), dai_build_adv_adjust(), dai_build_adv_override(), dai_choice_rule_name(), tab_building::delete_now(), diplomat_sabotage(), tab_building::edit_effects(), tab_building::edit_reqs(), handle_ruleset_building(), improvement_by_rule_name(), is_universal_needed(), load_ruleset_buildings(), tab_building::name_given(), process_attacker_want(), tab_building::refresh(), sanity_check_ruleset_data(), save_building_list(), sg_save_savefile(), tileset_setup_impr_type(), universal_kind_values(), universal_rule_name(), tab_building::update_bldg_info(), and want_tech_for_improvement_effect().
| void improvements_free | ( | ) |
Frees the memory associated with all improvements.
Definition at line 68 of file improvement.cpp.
Referenced by game_ruleset_free().
| void improvements_init | ( | ) |
Initialize building structures.
Definition at line 38 of file improvement.cpp.
Referenced by game_ruleset_init().
| bool is_great_wonder | ( | const struct impr_type * | pimprove | ) |
Is this building a great wonder?
Definition at line 726 of file improvement.cpp.
Referenced by api_methods_building_type_is_great_wonder(), base_want(), boot_help_texts(), calc_civ_score(), can_player_build_improvement_direct(), can_player_build_improvement_later(), can_player_build_unit_direct(), change_build_target(), city_build_building(), city_build_free_buildings(), city_from_great_wonder(), city_global_turn_notify(), city_improvement_name_translation(), city_turns_to_build(), freeciv::upkeep_widget::contextMenuEvent(), dai_build_adv_adjust(), dai_war_desire(), found_new_tech(), great_wonder_is_available(), great_wonder_is_built(), great_wonder_is_destroyed(), great_wonder_owner(), handle_edit_city(), initialize_globals(), is_wonder(), manual_command(), research_diagram::mousePressEvent(), nr_wonders(), num_world_buildings(), num_world_buildings_total(), remove_city(), report_wonders_of_the_world(), req_text_insert(), sanity_check_req_individual(), help_widget::set_topic_building(), help_widget::set_topic_tech(), sg_save_players(), target_get_section(), transfer_city(), wonder_built(), and wonder_destroyed().
| bool is_improvement | ( | const struct impr_type * | pimprove | ) |
Is this building a regular improvement?
Definition at line 742 of file improvement.cpp.
Referenced by api_methods_building_type_is_improvement(), apply_disaster(), calc_civ_score(), can_city_sell_building(), can_sell_building(), dai_find_source_building(), do_nuke_tile(), edit_buffer_copy(), get_economy_report_data(), city_production_model::populate(), and raze_city().
Returns TRUE if an improvement in a city is productive, in some way.
Note that unproductive improvements may become productive later, if appropriate conditions are met (e.g. a special building that isn't producing units under the current government might under another).
Definition at line 570 of file improvement.cpp.
Referenced by ba_human_wants(), building_advisor(), and building_crucial().
Returns TRUE if an improvement in a city is redundant, that is, the city wouldn't lose anything by losing the improvement, or gain anything by building it.
This means:
Definition at line 591 of file improvement.cpp.
Referenced by city_improvement_name_translation(), dai_city_sell_noncritical(), get_economy_report_data(), city_production_delegate::paint(), and sell_all_improvements().
| bool is_improvement_visible | ( | const struct impr_type * | pimprove | ) |
Return TRUE if the improvement should be visible to others without spying.
Definition at line 371 of file improvement.cpp.
Referenced by handle_city_short_info(), is_req_knowable(), popup_info_text(), and update_dumb_city().
| bool is_small_wonder | ( | const struct impr_type * | pimprove | ) |
Is this building a small wonder?
Definition at line 734 of file improvement.cpp.
Referenced by api_methods_building_type_is_small_wonder(), base_want(), city_build_building(), city_build_free_buildings(), city_from_small_wonder(), dai_war_desire(), handle_edit_city(), helptext_building(), is_wonder(), raze_city(), remove_city(), target_get_section(), and transfer_city().
| bool is_special_improvement | ( | const struct impr_type * | pimprove | ) |
Returns TRUE if this is a "special" improvement.
For example, spaceship parts and coinage in the default ruleset are considered special.
Definition at line 751 of file improvement.cpp.
Referenced by handle_edit_city(), and city_production_model::populate().
| bool is_wonder | ( | const struct impr_type * | pimprove | ) |
Returns whether improvement is some kind of wonder.
Both great wonders and small wonders count.
Definition at line 317 of file improvement.cpp.
Referenced by adjust_improvement_wants_by_effects(), api_methods_building_type_is_wonder(), ba_human_wants(), base_want(), building_advisor(), building_advisor_choose(), calc_civ_score(), city_add_improvement(), city_change_production_penalty(), city_from_wonder(), city_gold_worth(), city_improvement_upkeep(), city_migration_score(), city_remove_improvement(), collect_production_targets(), dai_build_adv_adjust(), dai_build_adv_override(), dai_choose_help_wonder(), dai_spend_gold(), do_city_migration(), initialize_globals(), is_improvement_visible(), num_continent_buildings(), num_player_buildings(), player_has_ever_built(), city_production_model::populate(), req_text_insert(), sanity_check_req_individual(), city_widget::select_building_something(), sg_save_player_main(), wonder_benefit(), wonder_built(), wonder_destroyed(), wonder_is_built(), wonder_is_lost(), and wonder_set_build_turn().
| enum test_result test_player_sell_building_now | ( | struct player * | pplayer, |
| const city * | pcity, | ||
| const struct impr_type * | pimprove | ||
| ) |
Return TRUE iff the player can sell the given improvement from city.
If pimprove is nullptr, returns iff city could sell some building type (this does not check if such building is in this city)
Definition at line 997 of file improvement.cpp.
Referenced by freeciv::improvement_seller::add_to_menu(), freeciv::improvement_seller::operator()(), and really_handle_city_sell().
Returns pointer when the improvement_type "exists" in this game, returns nullptr otherwise.
An improvement_type doesn't exist for any of:
Definition at line 194 of file improvement.cpp.
Referenced by advisor_choose_build(), boot_help_texts(), building_upgrades_to(), can_player_build_improvement_direct(), can_player_build_improvement_later(), can_sell_building(), and manual_command().
Build a wonder in the city.
Definition at line 759 of file improvement.cpp.
Referenced by city_add_improvement().
Remove a wonder from a city and destroy it if it's a great wonder.
To transfer a great wonder, use great_wonder_transfer.
Definition at line 784 of file improvement.cpp.
Referenced by city_remove_improvement().
Returns whether the player is currently in possession of this wonder (small or great) and it hasn't been just built this turn.
Definition at line 821 of file improvement.cpp.
Referenced by api_methods_player_has_wonder(), great_wonder_is_built(), num_player_buildings(), and player_has_ever_built().
Returns whether the player has lost this wonder after having owned it (small or great).
Definition at line 808 of file improvement.cpp.
Referenced by player_has_ever_built(), and sg_save_player_main().
All the city improvements: Use improvement_by_number(id) to access the array.
The improvement_types array is now setup in: server/ruleset.c (for the server) client/packhand.c (for the client)
Definition at line 1 of file improvement.cpp.
Referenced by improvement_array_first(), improvement_array_last(), improvement_by_number(), improvement_index(), and improvements_init().