![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include "fcintl.h"#include "name_translation.h"#include "support.h"#include "connection.h"#include "game.h"#include "government.h"#include "player.h"#include "traits.h"#include "nation.h"
Include dependency graph for nation.cpp:Go to the source code of this file.
Classes | |
| struct | nation_set |
| Functions for handling the nations. More... | |
| struct | nation_leader |
| Nation leader. More... | |
| struct | nation_city |
| Nation default cities. More... | |
| struct | nation_set_iter |
| Nation set iterator. More... | |
| struct | nation_group_iter |
| Nation group iterator. More... | |
Macros | |
| #define | NATION_CHECK(pnation, action) |
| Runs action if the nation is not valid. More... | |
| #define | NATION_SET_ITER(p) ((struct nation_set_iter *) (p)) |
| #define | NATION_GROUP_ITER(p) ((struct nation_group_iter *) (p)) |
Functions | |
| struct nation_type * | nation_by_translated_plural (const char *name) |
| Returns the nation that has the given (translated) plural noun. More... | |
| struct nation_type * | nation_by_rule_name (const char *name) |
| Returns the nation that has the given (untranslated) rule name (adjective). More... | |
| const char * | nation_rule_name (const struct nation_type *pnation) |
| Return the (untranslated) rule name of the nation (adjective form). More... | |
| const char * | nation_adjective_translation (const struct nation_type *pnation) |
| Return the (translated) adjective for the given nation. More... | |
| const char * | nation_plural_translation (const struct nation_type *pnation) |
| Return the (translated) plural noun of the given nation. More... | |
| const char * | nation_adjective_for_player (const struct player *pplayer) |
| Return the (translated) adjective for the given nation of a player. More... | |
| const char * | nation_plural_for_player (const struct player *pplayer) |
| Return the (translated) plural noun of the given nation of a player. More... | |
| bool | is_nation_pickable (const struct nation_type *nation) |
| Return whether a nation is "pickable" – whether players can select it at game start. More... | |
| bool | is_nation_playable (const struct nation_type *nation) |
| Return whether a nation is "playable"; i.e., whether a human player can choose this nation. More... | |
| enum barbarian_type | nation_barbarian_type (const struct nation_type *nation) |
| Returns which kind of barbarians can use this nation. More... | |
| const struct nation_leader_list * | nation_leaders (const struct nation_type *pnation) |
| Returns the list the nation leader names. More... | |
| struct nation_leader * | nation_leader_new (struct nation_type *pnation, const char *name, bool is_male) |
| Create a new leader for the nation. More... | |
| static void | nation_leader_destroy (struct nation_leader *pleader) |
| Destroy a nation leader created with nation_leader_new(). More... | |
| struct nation_leader * | nation_leader_by_name (const struct nation_type *pnation, const char *name) |
| Returns the nation leader structure which match 'name' or nullptr if not found. More... | |
| const char * | nation_leader_name (const struct nation_leader *pleader) |
| Return the name of the nation leader. More... | |
| bool | nation_leader_is_male (const struct nation_leader *pleader) |
| Return the sex of the nation leader. More... | |
| const char * | nation_legend_translation (const struct nation_type *pnation, const char *legend) |
| Return translated version of nation legend. More... | |
| const struct nation_city_list * | nation_cities (const struct nation_type *pnation) |
| Return the default cities of the nation (server only function). More... | |
| struct nation_city * | nation_city_new (struct nation_type *pnation, const char *name) |
| Create a new default city for the nation (server only function). More... | |
| static void | nation_city_destroy (struct nation_city *pncity) |
| Destroy a default nation city created with nation_city_new(). More... | |
| enum nation_city_preference | nation_city_preference_revert (enum nation_city_preference prefer) |
| Reverts the nation city preference. More... | |
| void | nation_city_set_terrain_preference (struct nation_city *pncity, const struct terrain *pterrain, enum nation_city_preference prefer) |
| Set the default nation city preference for the terrain. More... | |
| void | nation_city_set_river_preference (struct nation_city *pncity, enum nation_city_preference prefer) |
| Set the default nation city preference about rivers. More... | |
| const char * | nation_city_name (const struct nation_city *pncity) |
| Return the name of the default nation city. More... | |
| enum nation_city_preference | nation_city_terrain_preference (const struct nation_city *pncity, const struct terrain *pterrain) |
| Return the default nation city preference for the terrain. More... | |
| enum nation_city_preference | nation_city_river_preference (const struct nation_city *pncity) |
| Return the default nation city preference for rivers. More... | |
| struct nation_type * | nation_of_player (const struct player *pplayer) |
| Return the nation of a player. More... | |
| struct nation_type * | nation_of_city (const struct city *pcity) |
| Return the nation of the player who owns the city. More... | |
| struct nation_type * | nation_of_unit (const struct unit *punit) |
| Return the nation of the player who owns the unit. More... | |
| struct nation_type * | nation_by_number (const Nation_type_id nation) |
| Return the nation with the given index. More... | |
| Nation_type_id | nation_index (const struct nation_type *pnation) |
| Return the nation index. More... | |
| void | nations_alloc (int num) |
| Allocate space for the given number of nations. More... | |
| void | nations_free () |
| De-allocate the currently allocated nations. More... | |
| struct government * | init_government_of_nation (const struct nation_type *pnation) |
| Returns initial government type for this nation. More... | |
| struct nation_style * | style_of_nation (const struct nation_type *pnation) |
| Returns nation's style. More... | |
| const struct rgbcolor * | nation_color (const struct nation_type *pnation) |
| Returns nation's player color preference, or nullptr if none. More... | |
| int | nation_set_count () |
| Return the number of nation sets. More... | |
| int | nation_set_index (const struct nation_set *pset) |
| Return the nation set index. More... | |
| int | nation_set_number (const struct nation_set *pset) |
| Return the nation set index. More... | |
| struct nation_set * | nation_set_new (const char *set_name, const char *set_rule_name, const char *set_description) |
| Add new set into the array of nation sets. More... | |
| struct nation_set * | nation_set_by_number (int id) |
| Return the nation set with the given index. More... | |
| struct nation_set * | nation_set_by_rule_name (const char *name) |
| Return the nation set that has the given (untranslated) rule name. More... | |
| const char * | nation_set_untranslated_name (const struct nation_set *pset) |
| Return the untranslated name of a nation set (including qualifier, if any). More... | |
| const char * | nation_set_rule_name (const struct nation_set *pset) |
| Return the (untranslated) rule name of a nation set. More... | |
| const char * | nation_set_name_translation (const struct nation_set *pset) |
| Return the translated name of a nation set. More... | |
| const char * | nation_set_description (const struct nation_set *pset) |
| Return the (untranslated) user description of a nation set. More... | |
| bool | nation_is_in_set (const struct nation_type *pnation, const struct nation_set *pset) |
| Check if the given nation is in a given set. More... | |
| struct nation_set * | nation_set_by_setting_value (const char *setting) |
| Returns the nation set that would be selected by the given value of the 'nationset' server setting. More... | |
| size_t | nation_set_iter_sizeof () |
| Implementation of iterator 'sizeof' function. More... | |
| static void | nation_set_iter_next (struct iterator *iter) |
| Implementation of iterator 'next' function. More... | |
| static void * | nation_set_iter_get (const struct iterator *iter) |
| Implementation of iterator 'get' function. More... | |
| static bool | nation_set_iter_valid (const struct iterator *iter) |
| Implementation of iterator 'valid' function. More... | |
| struct iterator * | nation_set_iter_init (struct nation_set_iter *it) |
| Implementation of iterator 'init' function. More... | |
| int | nation_group_count () |
| Return the number of nation groups. More... | |
| int | nation_group_index (const struct nation_group *pgroup) |
| Return the nation group index. More... | |
| int | nation_group_number (const struct nation_group *pgroup) |
| Return the nation group index. More... | |
| struct nation_group * | nation_group_new (const char *name) |
| Add new group into the array of groups. More... | |
| struct nation_group * | nation_group_by_number (int id) |
| Return the nation group with the given index. More... | |
| struct nation_group * | nation_group_by_rule_name (const char *name) |
| Return the nation group that has the given (untranslated) rule name. More... | |
| void | nation_group_set_hidden (struct nation_group *pgroup, bool hidden) |
| Set whether this group should appear in the nation selection UI. More... | |
| void | nation_group_set_match (struct nation_group *pgroup, int match) |
| Set how much the AI will try to select a nation in the same group. More... | |
| bool | is_nation_group_hidden (struct nation_group *pgroup) |
| Return whether this group should appear in the nation selection UI. More... | |
| const char * | nation_group_untranslated_name (const struct nation_group *pgroup) |
| Return the untranslated name of a nation group (including qualifier, if any). More... | |
| const char * | nation_group_rule_name (const struct nation_group *pgroup) |
| Return the (untranslated) rule name of a nation group. More... | |
| const char * | nation_group_name_translation (const struct nation_group *pgroup) |
| Return the translated name of a nation group. More... | |
| bool | nation_is_in_group (const struct nation_type *pnation, const struct nation_group *pgroup) |
| Check if the given nation is in a given group. More... | |
| size_t | nation_group_iter_sizeof () |
| Implementation of iterator 'sizeof' function. More... | |
| static void | nation_group_iter_next (struct iterator *iter) |
| Implementation of iterator 'next' function. More... | |
| static void * | nation_group_iter_get (const struct iterator *iter) |
| Implementation of iterator 'get' function. More... | |
| static bool | nation_group_iter_valid (const struct iterator *iter) |
| Implementation of iterator 'valid' function. More... | |
| struct iterator * | nation_group_iter_init (struct nation_group_iter *it) |
| Implementation of iterator 'init' function. More... | |
| void | nation_sets_groups_init () |
| void | nation_sets_groups_free () |
| Frees and resets all nation set/group data. More... | |
| bool | can_conn_edit_players_nation (const struct connection *pconn, const struct player *pplayer) |
| Return TRUE iff the editor is allowed to edit the player's nation in pregame. More... | |
| int | nations_match (const struct nation_type *pnation1, const struct nation_type *pnation2, bool ignore_conflicts) |
| Returns how much two nations look good in the same game. More... | |
Variables | |
| std::vector< nation_type > | nations |
| static int | num_nation_sets |
| static struct nation_set | nation_sets [MAX_NUM_NATION_SETS] |
| static int | num_nation_groups |
| static struct nation_group | nation_groups [MAX_NUM_NATION_GROUPS] |
| #define NATION_CHECK | ( | pnation, | |
| action | |||
| ) |
Runs action if the nation is not valid.
Definition at line 76 of file nation.cpp.
| #define NATION_GROUP_ITER | ( | p | ) | ((struct nation_group_iter *) (p)) |
Definition at line 984 of file nation.cpp.
| #define NATION_SET_ITER | ( | p | ) | ((struct nation_set_iter *) (p)) |
Definition at line 761 of file nation.cpp.
| bool can_conn_edit_players_nation | ( | const struct connection * | pconn, |
| const struct player * | pplayer | ||
| ) |
Return TRUE iff the editor is allowed to edit the player's nation in pregame.
Definition at line 1046 of file nation.cpp.
Referenced by handle_nation_select_req(), and page_pregame::start_page_menu().
| struct government* init_government_of_nation | ( | const struct nation_type * | pnation | ) |
Returns initial government type for this nation.
Always returns non-nullptr – nation-specific government or failing that ruleset default government.
Definition at line 545 of file nation.cpp.
Referenced by create_animals(), create_barbarian_player(), dai_manage_government(), final_ruleset_adjustments(), handle_edit_player_create(), and split_player().
| bool is_nation_group_hidden | ( | struct nation_group * | pgroup | ) |
Return whether this group should appear in the nation selection UI.
Definition at line 920 of file nation.cpp.
Referenced by races_dialog::refresh().
| bool is_nation_pickable | ( | const struct nation_type * | nation | ) |
Return whether a nation is "pickable" – whether players can select it at game start.
(Client only function – on the server, use client_can_pick_nation().)
Definition at line 165 of file nation.cpp.
Referenced by races_dialog::set_index().
| bool is_nation_playable | ( | const struct nation_type * | nation | ) |
Return whether a nation is "playable"; i.e., whether a human player can choose this nation.
Barbarian and observer nations are not playable.
This does not check whether a nation is "used" or "available".
Definition at line 177 of file nation.cpp.
Referenced by client_can_pick_nation(), count_playable_nations(), generate_players(), handle_edit_player(), load_ruleset_nations(), pick_a_nation(), races_dialog::set_index(), and show_nationsets().
| const char* nation_adjective_for_player | ( | const struct player * | pplayer | ) |
Return the (translated) adjective for the given nation of a player.
You don't have to free the return pointer.
Definition at line 146 of file nation.cpp.
Referenced by announce_trade_route_removal(), check_city_migrations_player(), check_for_game_over(), col_nation(), cr_entry_nation(), debug_command(), diplomat_bribe(), diplomat_get_tech(), diplomat_incite(), diplomat_infiltrate_tile(), diplomat_sabotage(), do_attack(), do_capture_units(), do_city_migration(), do_expel_unit(), do_heal_unit(), do_nuke_tile(), get_full_nation(), handle_diplomacy_accept_treaty_req(), kill_unit(), make_contact(), plr_widget::nation_selected(), notify_actor_caught(), notify_actor_success(), notify_illegal_armistice_units(), popup_action_selection(), popup_info_text(), report_achievements(), report_demographics(), report_top_five_cities(), report_wonders_of_the_world(), show_players(), spaceship_arrived(), spaceship_lost(), spy_nuke_city(), spy_sabotage_unit(), spy_spread_plague(), spy_steal_gold(), spy_steal_some_maps(), transfer_unit(), unit_bombard(), unit_description(), unit_do_help_build(), pregame_options::update_buttons(), city_dialog::update_nation_table(), page_pregame::update_start_page(), and wakeup_neighbor_sentries().
| const char* nation_adjective_translation | ( | const struct nation_type * | pnation | ) |
Return the (translated) adjective for the given nation.
You don't have to free the return pointer.
Definition at line 126 of file nation.cpp.
Referenced by api_methods_nation_type_name_translation(), explain_why_no_action_enabled(), goto_dialog::fill_tab(), handle_nation_select_req(), illegal_action_msg(), nation_adjective_for_player(), req_text_insert(), races_dialog::set_index(), universal_name_translation(), and worklist_item_postpone_req_vec().
| enum barbarian_type nation_barbarian_type | ( | const struct nation_type * | nation | ) |
Returns which kind of barbarians can use this nation.
This does not check whether a nation is "used" or "available".
Definition at line 177 of file nation.cpp.
Referenced by assign_player_colors(), handle_edit_player(), hard_code_oblig_hard_reqs_ruleset(), load_ruleset_nations(), pick_a_nation(), sanity_check_ruleset_data(), and update_nations_with_startpos().
| struct nation_type* nation_by_number | ( | const Nation_type_id | nation | ) |
Return the nation with the given index.
This function returns nullptr for an out-of-range index (some callers rely on this).
Definition at line 450 of file nation.cpp.
Referenced by api_find_nation_type(), handle_edit_player(), handle_nation_availability(), handle_nation_select_req(), handle_player_info(), handle_ruleset_government_ruler_title(), handle_ruleset_nation(), load_nation_names(), races_dialog::nation_selected(), races_dialog::ok_pressed(), and universal_value_initial().
| struct nation_type* nation_by_rule_name | ( | const char * | name | ) |
Returns the nation that has the given (untranslated) rule name (adjective).
Returns NO_NATION_SELECTED if none match.
Definition at line 98 of file nation.cpp.
Referenced by api_find_nation_type_by_name(), load_ruleset_nations(), playernation_command(), sanity_check_ruleset_data(), save_nations_ruleset(), sg_load_map_startpos(), sg_load_player_main(), and universal_by_number().
| struct nation_type* nation_by_translated_plural | ( | const char * | name | ) |
Returns the nation that has the given (translated) plural noun.
Returns NO_NATION_SELECTED if none match.
Definition at line 83 of file nation.cpp.
Referenced by help_dialog::make_tree(), and help_widget::set_topic_nation().
| const struct nation_city_list* nation_cities | ( | const struct nation_type * | pnation | ) |
Return the default cities of the nation (server only function).
Definition at line 307 of file nation.cpp.
Referenced by city_name_suggestion(), and is_default_city_name().
|
static |
Destroy a default nation city created with nation_city_new().
Definition at line 337 of file nation.cpp.
Referenced by nation_type::nation_type().
| const char* nation_city_name | ( | const struct nation_city * | pncity | ) |
Return the name of the default nation city.
Definition at line 388 of file nation.cpp.
Referenced by is_default_city_name(), save_nation(), and search_for_city_name().
| struct nation_city* nation_city_new | ( | struct nation_type * | pnation, |
| const char * | name | ||
| ) |
Create a new default city for the nation (server only function).
Definition at line 318 of file nation.cpp.
Referenced by load_city_name_list().
| enum nation_city_preference nation_city_preference_revert | ( | enum nation_city_preference | prefer | ) |
Reverts the nation city preference.
Definition at line 337 of file nation.cpp.
Referenced by evaluate_city_name_priority().
| enum nation_city_preference nation_city_river_preference | ( | const struct nation_city * | pncity | ) |
Return the default nation city preference for rivers.
Definition at line 388 of file nation.cpp.
Referenced by evaluate_city_name_priority(), and save_nation().
| void nation_city_set_river_preference | ( | struct nation_city * | pncity, |
| enum nation_city_preference | prefer | ||
| ) |
Set the default nation city preference about rivers.
Definition at line 378 of file nation.cpp.
Referenced by load_city_name_list().
| void nation_city_set_terrain_preference | ( | struct nation_city * | pncity, |
| const struct terrain * | pterrain, | ||
| enum nation_city_preference | prefer | ||
| ) |
Set the default nation city preference for the terrain.
Definition at line 366 of file nation.cpp.
Referenced by load_city_name_list().
| enum nation_city_preference nation_city_terrain_preference | ( | const struct nation_city * | pncity, |
| const struct terrain * | pterrain | ||
| ) |
Return the default nation city preference for the terrain.
Definition at line 388 of file nation.cpp.
Referenced by evaluate_city_name_priority(), and save_nation().
| const struct rgbcolor* nation_color | ( | const struct nation_type * | pnation | ) |
Returns nation's player color preference, or nullptr if none.
Server only function.
Definition at line 568 of file nation.cpp.
Referenced by assign_player_colors(), player_preferred_color(), and plrcol_validate().
| struct nation_group* nation_group_by_number | ( | int | id | ) |
Return the nation group with the given index.
This function returns nullptr for an out-of-range index (some callers rely on this).
Definition at line 870 of file nation.cpp.
Referenced by handle_ruleset_nation(), races_dialog::refresh(), races_dialog::set_index(), and universal_value_initial().
| struct nation_group* nation_group_by_rule_name | ( | const char * | name | ) |
Return the nation group that has the given (untranslated) rule name.
Returns nullptr if no group is found.
Definition at line 882 of file nation.cpp.
Referenced by load_ruleset_nations(), nation_group_new(), nation_set_new(), and universal_by_number().
| int nation_group_count | ( | ) |
Return the number of nation groups.
Definition at line 809 of file nation.cpp.
Referenced by nation_group_iter_init(), races_dialog::refresh(), send_ruleset_nations(), and universal_value_initial().
| int nation_group_index | ( | const struct nation_group * | pgroup | ) |
Return the nation group index.
Definition at line 814 of file nation.cpp.
Referenced by handle_ruleset_nation_groups(), and nation_group_number().
|
static |
Implementation of iterator 'get' function.
Definition at line 1005 of file nation.cpp.
Referenced by nation_group_iter_init().
| struct iterator* nation_group_iter_init | ( | struct nation_group_iter * | it | ) |
Implementation of iterator 'init' function.
Definition at line 1022 of file nation.cpp.
|
static |
Implementation of iterator 'next' function.
Definition at line 997 of file nation.cpp.
Referenced by nation_group_iter_init().
| size_t nation_group_iter_sizeof | ( | ) |
Implementation of iterator 'sizeof' function.
Definition at line 989 of file nation.cpp.
|
static |
Implementation of iterator 'valid' function.
Definition at line 1013 of file nation.cpp.
Referenced by nation_group_iter_init().
| const char* nation_group_name_translation | ( | const struct nation_group * | pgroup | ) |
Return the translated name of a nation group.
You don't have to free the return pointer.
Definition at line 953 of file nation.cpp.
Referenced by races_dialog::refresh(), req_text_insert(), universal_name_translation(), and worklist_item_postpone_req_vec().
| struct nation_group* nation_group_new | ( | const char * | name | ) |
Add new group into the array of groups.
Definition at line 831 of file nation.cpp.
Referenced by handle_ruleset_nation_groups(), and load_nation_names().
| int nation_group_number | ( | const struct nation_group * | pgroup | ) |
Return the nation group index.
Definition at line 823 of file nation.cpp.
Referenced by send_ruleset_nations(), and universal_number().
| const char* nation_group_rule_name | ( | const struct nation_group * | pgroup | ) |
Return the (untranslated) rule name of a nation group.
You don't have to free the return pointer.
Definition at line 942 of file nation.cpp.
Referenced by save_nation(), universal_kind_values(), and universal_rule_name().
| void nation_group_set_hidden | ( | struct nation_group * | pgroup, |
| bool | hidden | ||
| ) |
Set whether this group should appear in the nation selection UI.
Definition at line 900 of file nation.cpp.
Referenced by load_ruleset_nations().
| void nation_group_set_match | ( | struct nation_group * | pgroup, |
| int | match | ||
| ) |
Set how much the AI will try to select a nation in the same group.
Server only function.
Definition at line 910 of file nation.cpp.
Referenced by load_ruleset_nations().
| const char* nation_group_untranslated_name | ( | const struct nation_group * | pgroup | ) |
Return the untranslated name of a nation group (including qualifier, if any).
You usually want nation_group_rule_name() instead. You don't have to free the return pointer.
Definition at line 932 of file nation.cpp.
Referenced by send_ruleset_nations().
| Nation_type_id nation_index | ( | const struct nation_type * | pnation | ) |
Return the nation index.
Currently same as nation_index(), paired with nation_count() indicates use as an array index.
Definition at line 464 of file nation.cpp.
Referenced by city_name_suggestion(), get_nation_flag_sprite(), get_nation_shield_sprite(), get_unit_nation_flag_sprite(), government_ruler_title_new(), hard_code_oblig_hard_reqs_ruleset(), load_nation_names(), load_ruleset_nations(), package_player_common(), pick_a_nation(), ruler_title_check(), ruler_title_for_player(), send_nation_availability_real(), send_ruleset_governments(), send_ruleset_nations(), races_dialog::set_index(), startpos_pack(), startpos_unpack(), tileset_setup_nation_flag(), and universal_number().
| bool nation_is_in_group | ( | const struct nation_type * | pnation, |
| const struct nation_group * | pgroup | ||
| ) |
Check if the given nation is in a given group.
Definition at line 962 of file nation.cpp.
Referenced by nation_contra_group(), save_nation(), and races_dialog::set_index().
| bool nation_is_in_set | ( | const struct nation_type * | pnation, |
| const struct nation_set * | pset | ||
| ) |
Check if the given nation is in a given set.
Definition at line 712 of file nation.cpp.
Referenced by boot_help_texts(), fit_nationset_to_players(), helptext_advance(), helptext_building(), helptext_unit(), load_ruleset_nations(), nation_is_in_current_set(), save_nation(), and show_nationsets().
| struct nation_leader* nation_leader_by_name | ( | const struct nation_type * | pnation, |
| const char * | name | ||
| ) |
Returns the nation leader structure which match 'name' or nullptr if not found.
Definition at line 241 of file nation.cpp.
Referenced by generate_players(), player_nation_defaults(), and server_player_name_is_allowed().
|
static |
Destroy a nation leader created with nation_leader_new().
Definition at line 230 of file nation.cpp.
Referenced by nation_type::nation_type().
| bool nation_leader_is_male | ( | const struct nation_leader * | pleader | ) |
Return the sex of the nation leader.
Definition at line 266 of file nation.cpp.
Referenced by races_dialog::nation_selected(), player_nation_defaults(), save_nation(), and send_ruleset_nations().
| const char* nation_leader_name | ( | const struct nation_leader * | pleader | ) |
Return the name of the nation leader.
Definition at line 257 of file nation.cpp.
Referenced by check_leader_names(), races_dialog::nation_selected(), pick_random_player_name(), save_nation(), and send_ruleset_nations().
| struct nation_leader* nation_leader_new | ( | struct nation_type * | pnation, |
| const char * | name, | ||
| bool | is_male | ||
| ) |
Create a new leader for the nation.
Definition at line 215 of file nation.cpp.
Referenced by handle_ruleset_nation(), and load_ruleset_nations().
| const struct nation_leader_list* nation_leaders | ( | const struct nation_type * | pnation | ) |
Returns the list the nation leader names.
Definition at line 206 of file nation.cpp.
Referenced by check_leader_names(), races_dialog::nation_selected(), pick_random_player_name(), and send_ruleset_nations().
| const char* nation_legend_translation | ( | const struct nation_type * | pnation, |
| const char * | legend | ||
| ) |
Return translated version of nation legend.
Definition at line 275 of file nation.cpp.
Referenced by handle_ruleset_nation().
| struct nation_type* nation_of_city | ( | const struct city * | pcity | ) |
Return the nation of the player who owns the city.
Definition at line 429 of file nation.cpp.
Referenced by city_build_unit(), city_log_prefix(), city_packet_common(), client_remove_unit(), game_remove_unit(), get_city_flag_sprite(), and cma_yoloswag::handle_city().
| struct nation_type* nation_of_player | ( | const struct player * | pplayer | ) |
Return the nation of a player.
Definition at line 419 of file nation.cpp.
Referenced by add_clause(), diplo_dlg::add_widget(), auto_settlers_player(), city_build_free_buildings(), city_name_suggestion(), civil_war(), create_barbarian_player(), dai_manage_government(), plr_item::data(), diplo_wdg::diplo_wdg(), do_attack(), freeciv::layer_base_flags::fill_sprite_array(), goto_dialog::fill_tab(), final_ruleset_adjustments(), game_remove_city(), give_initial_techs(), handle_diplomacy_accept_treaty_req(), handle_edit_player(), init_new_game(), is_default_city_name(), nation_adjective_for_player(), nation_of_city(), nation_of_unit(), nation_plural_for_player(), pageGame::pageGame(), pick_a_nation(), player_preferred_color(), pageGame::reloadSidebarIcons(), ruler_title_for_player(), send_to_metaserver(), sg_load_players(), sg_load_sanitycheck(), sg_save_player_main(), split_player(), transfer_unit(), unit_bombard(), unit_nuke(), city_dialog::update_nation_table(), and endgame_report::update_report().
| struct nation_type* nation_of_unit | ( | const struct unit * | punit | ) |
Return the nation of the player who owns the unit.
Definition at line 438 of file nation.cpp.
Referenced by bodyguard_log_prefix(), caravan_optimize_callback(), client_remove_unit(), dai_caravan_goto(), dai_diplomat_city(), dai_hunter_manage(), dai_manage_caravan(), debug_command(), do_attack(), game_remove_unit(), get_unit_nation_flag_sprite(), handle_unit_packet_common(), immediate_destination(), teleport_unit_to_city(), transfer_city_units(), and unit_log_prefix().
| const char* nation_plural_for_player | ( | const struct player * | pplayer | ) |
Return the (translated) plural noun of the given nation of a player.
You don't have to free the return pointer.
Definition at line 155 of file nation.cpp.
Referenced by diplo_dlg::add_widget(), announce_player(), announce_trade_route_removal(), api_edit_give_technology(), change_build_target(), check_for_game_over(), city_build_building(), civil_war(), client_diplomacy_clause_string(), create_barbarian_player(), dem_line_item(), diplo_wdg::diplo_wdg(), diplomat_bribe(), diplomat_embassy(), diplomat_sabotage(), do_capture_units(), do_expel_unit(), do_nuclear_explosion(), do_nuke_tile(), do_unit_establish_trade(), do_unit_strike_city_building(), do_unit_strike_city_production(), fit_nationset_to_players(), forget_tech_transfered(), government_change(), handle_diplomacy_accept_treaty_req(), handle_diplomacy_cancel_pact_explicit(), handle_player_change_government(), handle_spaceship_launch(), historian_generic(), is_allowed_city_name(), kill_player(), make_contact(), plr_widget::nation_selected(), notify_global_caught(), notify_global_success(), notify_victim_caught(), notify_victim_success(), remove_illegal_armistice_units(), research_pretty_name(), mr_menu::save_image(), send_to_metaserver(), sg_load_players(), show_new_turn_info(), spy_nuke_city(), spy_sabotage_unit(), spy_spread_plague(), spy_steal_gold(), spy_steal_some_maps(), steal_a_tech(), transfer_unit(), update_diplomatics(), and pageGame::updateSidebarTooltips().
| const char* nation_plural_translation | ( | const struct nation_type * | pnation | ) |
Return the (translated) plural noun of the given nation.
You don't have to free the return pointer.
Definition at line 136 of file nation.cpp.
Referenced by api_methods_nation_type_plural_translation(), boot_help_texts(), handle_edit_player(), helptext_advance(), helptext_building(), helptext_unit(), nation_by_translated_plural(), nation_plural_for_player(), req_text_insert(), top_bar_right_click_diplomacy(), and worklist_item_postpone_req_vec().
| const char* nation_rule_name | ( | const struct nation_type * | pnation | ) |
Return the (untranslated) rule name of the nation (adjective form).
You don't have to free the return pointer.
Definition at line 115 of file nation.cpp.
Referenced by add_clause(), api_methods_nation_type_rule_name(), auto_settlers_player(), bodyguard_log_prefix(), caravan_optimize_callback(), city_build_unit(), city_log_prefix(), city_name_suggestion(), city_packet_common(), civil_war(), client_remove_unit(), dai_caravan_goto(), dai_diplomat_city(), dai_hunter_manage(), dai_manage_caravan(), debug_command(), do_attack(), game_remove_city(), game_remove_unit(), government_ruler_title_new(), cma_yoloswag::handle_city(), handle_diplomacy_accept_treaty_req(), handle_ruleset_nation(), handle_unit_packet_common(), immediate_destination(), init_new_game(), load_ruleset_nations(), nation_by_rule_name(), pick_a_nation(), playernation_command(), ruler_title_check(), ruler_title_for_player(), sanity_check_ruleset_data(), save_nation(), sg_load_players(), sg_load_sanitycheck(), sg_save_map_startpos(), sg_save_player_main(), teleport_unit_to_city(), tileset_setup_nation_flag(), transfer_city_units(), transfer_unit(), unit_bombard(), unit_log_prefix(), unit_nuke(), universal_kind_values(), and universal_rule_name().
| struct nation_set* nation_set_by_number | ( | int | id | ) |
Return the nation set with the given index.
This function returns nullptr for an out-of-range index (some callers rely on this).
Definition at line 640 of file nation.cpp.
Referenced by fit_nationset_to_players(), handle_ruleset_nation(), load_ruleset_nations(), and nation_set_by_setting_value().
| struct nation_set* nation_set_by_rule_name | ( | const char * | name | ) |
Return the nation set that has the given (untranslated) rule name.
Returns nullptr if no set is found.
Definition at line 652 of file nation.cpp.
Referenced by load_ruleset_nations(), nation_group_new(), nation_set_by_setting_value(), nation_set_new(), nationset_callback(), and races_dialog::nationset_changed().
| struct nation_set* nation_set_by_setting_value | ( | const char * | setting | ) |
Returns the nation set that would be selected by the given value of the 'nationset' server setting.
This differs from nation_set_by_rule_name() for the empty string, where the first (ruleset default) nationset will be used; and similarly for a nationset not matched in the ruleset. The knowledge of the interpretation of this setting encapsulated here is required on both server and client.
Definition at line 736 of file nation.cpp.
Referenced by client_current_nation_set(), current_nationset(), races_dialog::nationset_changed(), and races_dialog::update_nationset_combo().
| int nation_set_count | ( | ) |
Return the number of nation sets.
Definition at line 577 of file nation.cpp.
Referenced by aifill(), fit_nationset_to_players(), load_ruleset_nations(), nation_set_iter_init(), races_dialog::races_dialog(), send_ruleset_nations(), and start_command().
| const char* nation_set_description | ( | const struct nation_set * | pset | ) |
Return the (untranslated) user description of a nation set.
You don't have to free the return pointer.
Definition at line 703 of file nation.cpp.
Referenced by save_nations_ruleset(), send_ruleset_nations(), show_nationsets(), and races_dialog::update_nationset_combo().
| int nation_set_index | ( | const struct nation_set * | pset | ) |
Return the nation set index.
Definition at line 582 of file nation.cpp.
Referenced by fit_nationset_to_players(), handle_ruleset_nation_sets(), nation_set_number(), and races_dialog::update_nationset_combo().
|
static |
Implementation of iterator 'get' function.
Definition at line 779 of file nation.cpp.
Referenced by nation_set_iter_init().
| struct iterator* nation_set_iter_init | ( | struct nation_set_iter * | it | ) |
Implementation of iterator 'init' function.
Definition at line 796 of file nation.cpp.
|
static |
Implementation of iterator 'next' function.
Definition at line 771 of file nation.cpp.
Referenced by nation_set_iter_init().
| size_t nation_set_iter_sizeof | ( | ) |
Implementation of iterator 'sizeof' function.
Definition at line 766 of file nation.cpp.
|
static |
Implementation of iterator 'valid' function.
Definition at line 787 of file nation.cpp.
Referenced by nation_set_iter_init().
| const char* nation_set_name_translation | ( | const struct nation_set * | pset | ) |
Return the translated name of a nation set.
You don't have to free the return pointer.
Definition at line 693 of file nation.cpp.
Referenced by races_dialog::races_dialog(), and show_nationsets().
| struct nation_set* nation_set_new | ( | const char * | set_name, |
| const char * | set_rule_name, | ||
| const char * | set_description | ||
| ) |
Add new set into the array of nation sets.
Definition at line 599 of file nation.cpp.
Referenced by handle_ruleset_nation_sets(), and load_ruleset_nations().
| int nation_set_number | ( | const struct nation_set * | pset | ) |
Return the nation set index.
Definition at line 591 of file nation.cpp.
Referenced by load_ruleset_nations(), and send_ruleset_nations().
| const char* nation_set_rule_name | ( | const struct nation_set * | pset | ) |
Return the (untranslated) rule name of a nation set.
You don't have to free the return pointer.
Definition at line 682 of file nation.cpp.
Referenced by fit_nationset_to_players(), load_ruleset_nations(), races_dialog::races_dialog(), save_nation(), save_nations_ruleset(), send_ruleset_nations(), and show_nationsets().
| const char* nation_set_untranslated_name | ( | const struct nation_set * | pset | ) |
Return the untranslated name of a nation set (including qualifier, if any).
You usually want nation_set_rule_name() instead. You don't have to free the return pointer.
Definition at line 672 of file nation.cpp.
Referenced by save_nations_ruleset(), and send_ruleset_nations().
| void nation_sets_groups_free | ( | ) |
Frees and resets all nation set/group data.
Definition at line 1040 of file nation.cpp.
Referenced by game_ruleset_free().
| void nation_sets_groups_init | ( | ) |
Definition at line 1035 of file nation.cpp.
Referenced by game_ruleset_init().
| void nations_alloc | ( | int | num | ) |
Allocate space for the given number of nations.
Definition at line 520 of file nation.cpp.
Referenced by handle_ruleset_control(), and load_nation_names().
| void nations_free | ( | ) |
De-allocate the currently allocated nations.
Definition at line 533 of file nation.cpp.
Referenced by game_ruleset_free().
| int nations_match | ( | const struct nation_type * | pnation1, |
| const struct nation_type * | pnation2, | ||
| bool | ignore_conflicts | ||
| ) |
Returns how much two nations look good in the same game.
Nations in the same group are considered to match, if that nation group has a 'match' greater than zero. Negative return value means that we really really don't want these nations together. This is dictated by "conflicts_with" in individual nation definitions. (If 'ignore_conflicts' is set, conflicts are not taken into account at all.) Server side function.
Definition at line 1065 of file nation.cpp.
Referenced by pick_a_nation().
| struct nation_style* style_of_nation | ( | const struct nation_type * | pnation | ) |
Returns nation's style.
Definition at line 558 of file nation.cpp.
Referenced by races_dialog::nation_selected(), player_nation_defaults(), and playernation_command().
|
static |
Definition at line 41 of file nation.cpp.
Referenced by nation_group_by_number(), nation_group_index(), nation_group_iter_init(), and nation_group_new().
|
static |
Definition at line 39 of file nation.cpp.
Referenced by nation_set_by_number(), nation_set_index(), nation_set_iter_init(), and nation_set_new().
| std::vector<nation_type> nations |
Definition at line 38 of file nation.cpp.
Referenced by assign_player_colors(), boot_help_texts(), city_name_suggestion(), count_playable_nations(), generate_players(), hard_code_oblig_hard_reqs_ruleset(), helptext_advance(), helptext_building(), helptext_unit(), load_nation_names(), load_ruleset_nations(), nation_by_number(), nation_by_rule_name(), nation_by_translated_plural(), nation_index(), nations_alloc(), nations_free(), pick_a_nation(), plrcol_validate(), races_dialog::refresh(), sanity_check_ruleset_data(), save_nations_ruleset(), send_nation_availability_real(), send_ruleset_nations(), races_dialog::set_index(), sg_save_map_startpos(), sg_save_player_cities(), show_nationsets(), startpos_unpack(), tilespec_reread(), universal_kind_values(), and update_nations_with_startpos().
|
static |
Definition at line 41 of file nation.cpp.
Referenced by nation_group_by_number(), nation_group_count(), nation_group_new(), nation_sets_groups_free(), and nation_sets_groups_init().
|
static |
Definition at line 39 of file nation.cpp.
Referenced by nation_set_by_number(), nation_set_count(), nation_set_new(), nation_sets_groups_free(), and nation_sets_groups_init().