21 #define NO_NATION_SELECTED (nullptr)
24 #define NATION_NONE -1
27 extern std::vector<nation_type>
nations;
33 #define SPECLIST_TAG nation_city
34 #define SPECLIST_TYPE struct nation_city
36 #define nation_city_list_iterate(citylist, pncity) \
37 TYPED_LIST_ITERATE(struct nation_city, citylist, pncity)
38 #define nation_city_list_iterate_end LIST_ITERATE_END
42 #define SPECLIST_TAG nation_leader
43 #define SPECLIST_TYPE struct nation_leader
45 #define nation_leader_list_iterate(leaderlist, pleader) \
46 TYPED_LIST_ITERATE(struct nation_leader, leaderlist, pleader)
47 #define nation_leader_list_iterate_end LIST_ITERATE_END
51 #define SPECLIST_TAG nation_set
52 #define SPECLIST_TYPE struct nation_set
54 #define nation_set_list_iterate(setlist, pset) \
55 TYPED_LIST_ITERATE(struct nation_set, setlist, pset)
56 #define nation_set_list_iterate_end LIST_ITERATE_END
60 #define SPECLIST_TAG nation_group
61 #define SPECLIST_TYPE struct nation_group
63 #define nation_group_list_iterate(grouplist, pgroup) \
64 TYPED_LIST_ITERATE(struct nation_group, grouplist, pgroup)
65 #define nation_group_list_iterate_end LIST_ITERATE_END
69 #define SPECLIST_TAG nation
70 #define SPECLIST_TYPE struct nation_type
72 #define nation_list_iterate(nationlist, pnation) \
73 TYPED_LIST_ITERATE(struct nation_type, nationlist, pnation)
74 #define nation_list_iterate_end LIST_ITERATE_END
84 struct nation_leader_list *
leaders =
nullptr;
89 enum barbarian_type
barb_type = NOT_A_BARBARIAN;
92 struct nation_set_list *
sets;
105 std::array<unit_type *, MAX_NUM_UNIT_LIST>
init_units = {
nullptr};
195 const struct player *pplayer);
198 const struct nation_leader_list *
213 const struct nation_city_list *
223 const struct terrain *pterrain,
229 const struct terrain *pterrain);
239 const char *set_rule_name,
240 const char *set_description);
283 #define nation_sets_iterate(NAME_pset) \
284 generic_iterate(struct nation_set_iter, struct nation_set *, NAME_pset, \
285 nation_set_iter_sizeof, nation_set_iter_init)
286 #define nation_sets_iterate_end generic_iterate_end
292 #define nation_groups_iterate(NAME_pgroup) \
293 generic_iterate(struct nation_group_iter, struct nation_group *, \
294 NAME_pgroup, nation_group_iter_sizeof, \
295 nation_group_iter_init)
296 #define nation_groups_iterate_end generic_iterate_end
303 const struct nation_type *pnation2,
bool ignore_conflicts);
#define MAX_NUM_BUILDING_LIST
#define MAX_NUM_TECH_LIST
struct nation_set * nation_set_by_number(int id)
Return the nation set with the given index.
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.
struct nation_type * nation_by_number(const Nation_type_id nation)
Return the nation with the given index.
void nation_sets_groups_init()
size_t nation_set_iter_sizeof()
Implementation of iterator 'sizeof' function.
void nation_sets_groups_free()
Frees and resets all nation set/group data.
struct nation_style * style_of_nation(const struct nation_type *pnation)
Returns nation's style.
const char * nation_set_name_translation(const struct nation_set *pset)
Return the translated name of a nation set.
struct nation_type * nation_of_city(const struct city *pcity)
Return the nation of the player who owns the city.
const char * nation_group_name_translation(const struct nation_group *pgroup)
Return the translated name of a nation group.
enum nation_city_preference nation_city_preference_revert(enum nation_city_preference prefer)
Reverts the nation city preference.
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.
int nation_group_index(const struct nation_group *pgroup)
Return the nation group index.
struct nation_leader * nation_leader_new(struct nation_type *pnation, const char *name, bool is_male)
Create a new leader for the nation.
size_t nation_group_iter_sizeof()
Implementation of iterator 'sizeof' function.
struct iterator * nation_group_iter_init(struct nation_group_iter *it)
Implementation of iterator 'init' function.
const char * nation_set_untranslated_name(const struct nation_set *pset)
Return the untranslated name of a nation set (including qualifier, if any).
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.
bool nation_leader_is_male(const struct nation_leader *pleader)
Return the sex of the nation leader.
struct government * init_government_of_nation(const struct nation_type *pnation)
Returns initial government type for this nation.
int nation_set_count()
Return the number of nation sets.
int nation_set_index(const struct nation_set *pset)
Return the nation set index.
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.
bool is_nation_pickable(const struct nation_type *nation)
Return whether a nation is "pickable" – whether players can select it at game start.
const char * nation_rule_name(const struct nation_type *pnation)
Return the (untranslated) rule name of the nation (adjective form).
std::vector< nation_type > nations
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.
struct nation_city * nation_city_new(struct nation_type *pnation, const char *name)
Create a new default city for the nation (server only function).
int nation_group_count()
Return the number of nation groups.
struct nation_group * nation_group_new(const char *name)
Add new group into the array of groups.
int nation_set_number(const struct nation_set *pset)
Return the nation set index.
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.
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.
const char * nation_adjective_translation(const struct nation_type *pnation)
Return the (translated) adjective for the given nation.
struct nation_group * nation_group_by_rule_name(const char *name)
Return the nation group that has the given (untranslated) rule name.
const char * nation_plural_for_player(const struct player *pplayer)
Return the (translated) plural noun of the given nation of a player.
void nation_city_set_river_preference(struct nation_city *pncity, enum nation_city_preference prefer)
Set the default nation city preference about rivers.
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.
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.
const struct rgbcolor * nation_color(const struct nation_type *pnation)
Returns nation's player color preference, or nullptr if none.
struct nation_type * nation_of_unit(const struct unit *punit)
Return the nation of the player who owns the unit.
enum nation_city_preference nation_city_river_preference(const struct nation_city *pncity)
Return the default nation city preference for rivers.
const char * nation_set_rule_name(const struct nation_set *pset)
Return the (untranslated) rule name of a nation set.
struct iterator * nation_set_iter_init(struct nation_set_iter *it)
Implementation of iterator 'init' function.
const char * nation_adjective_for_player(const struct player *pplayer)
Return the (translated) adjective for the given nation of a player.
const char * nation_legend_translation(const struct nation_type *pnation, const char *legend)
Return translated version of nation legend.
struct nation_group * nation_group_by_number(int id)
Return the nation group with the given index.
const char * nation_set_description(const struct nation_set *pset)
Return the (untranslated) user description of a nation set.
bool is_nation_group_hidden(struct nation_group *pgroup)
Return whether this group should appear in the nation selection UI.
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.
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.
struct nation_type * nation_by_rule_name(const char *name)
Returns the nation that has the given (untranslated) rule name (adjective).
Nation_type_id nation_index(const struct nation_type *pnation)
Return the nation index.
const char * nation_leader_name(const struct nation_leader *pleader)
Return the name of the nation leader.
const char * nation_plural_translation(const struct nation_type *pnation)
Return the (translated) plural noun of the given nation.
struct nation_type * nation_of_player(const struct player *pplayer)
Return the nation of a player.
const char * nation_city_name(const struct nation_city *pncity)
Return the name of the default nation city.
void nations_free()
De-allocate the currently allocated nations.
const struct nation_city_list * nation_cities(const struct nation_type *pnation)
Return the default cities of the nation (server only function).
const char * nation_group_untranslated_name(const struct nation_group *pgroup)
Return the untranslated name of a nation group (including qualifier, if any).
const struct nation_leader_list * nation_leaders(const struct nation_type *pnation)
Returns the list the nation leader names.
struct nation_type * nation_by_translated_plural(const char *name)
Returns the nation that has the given (translated) plural noun.
void nation_group_set_hidden(struct nation_group *pgroup, bool hidden)
Set whether this group should appear in the nation selection UI.
struct nation_set * nation_set_by_rule_name(const char *name)
Return the nation set that has the given (untranslated) rule name.
void nations_alloc(int num)
Allocate space for the given number of nations.
enum barbarian_type nation_barbarian_type(const struct nation_type *nation)
Returns which kind of barbarians can use this nation.
const char * nation_group_rule_name(const struct nation_group *pgroup)
Return the (untranslated) rule name of a nation group.
int nation_group_number(const struct nation_group *pgroup)
Return the nation group index.
struct name_translation name
struct nation_group::@52::@54 server
Functions for handling the nations.
int init_buildings[MAX_NUM_BUILDING_LIST]
struct nation_list * conflicts_with
struct nation_group_list * groups
struct name_translation noun_plural
struct nation_list * parent_nations
struct nation_set_list * sets
char flag_graphic_str[MAX_LEN_NAME]
struct name_translation adjective
struct trait_limits * traits
char flag_graphic_alt[MAX_LEN_NAME]
struct nation_leader_list * leaders
struct nation_type::@48::@50 server
std::array< unit_type *, MAX_NUM_UNIT_LIST > init_units
Nation_type_id item_number
enum barbarian_type barb_type
char * translation_domain
nation_type()
Allocate resources associated with the given nation.
struct nation_type::@48::@51 client
struct nation_style * style
~nation_type()
De-allocate resources associated with the given nation.
struct nation_city_list * default_cities
int init_techs[MAX_NUM_TECH_LIST]
government * init_government
struct nation_list * civilwar_nations