98 if (gov < 0 || gov >=
game.
control.government_count) {
174 nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
192 const char *ruler_male_title,
193 const char *ruler_female_title)
198 name_set(&pruler_title->male, domain, ruler_male_title);
199 name_set(&pruler_title->female, domain, ruler_female_title);
220 if (
nullptr != pruler_title->
pnation) {
221 qCritical(
"\"%s\" male ruler title for nation \"%s\" (nb %d) "
222 "is not a format. It should match \"%%s\"",
227 qCritical(
"\"%s\" male ruler title is not a format. "
228 "It should match \"%%s\"",
235 if (
nullptr != pruler_title->
pnation) {
236 qCritical(
"\"%s\" female ruler title for nation \"%s\" (nb %d) "
237 "is not a format. It should match \"%%s\"",
242 qCritical(
"\"%s\" female ruler title is not a format. "
243 "It should match \"%%s\"",
250 if (
nullptr != pruler_title->
pnation) {
251 qCritical(
"Translation of \"%s\" male ruler title for nation \"%s\" "
252 "(nb %d) is not a format (\"%s\"). It should match \"%%s\"",
258 qCritical(
"Translation of \"%s\" male ruler title is not a format "
259 "(\"%s\"). It should match \"%%s\"",
267 if (
nullptr != pruler_title->
pnation) {
268 qCritical(
"Translation of \"%s\" female ruler title for nation \"%s\" "
269 "(nb %d) is not a format (\"%s\"). It should match \"%%s\"",
275 qCritical(
"Translation of \"%s\" female ruler title is not a format "
276 "(\"%s\"). It should match \"%%s\"",
289 QHash<const struct nation_type *, struct ruler_title *> *
302 const char *ruler_male_title,
const char *ruler_female_title)
304 const char *domain =
nullptr;
320 qCritical(
"Ruler title for government \"%s\" (nb %d) and "
321 "nation \"%s\" (nb %d) was set twice.",
325 qCritical(
"Default ruler title for government \"%s\" (nb %d) "
380 qCritical(
"Missing title for government \"%s\" (nb %d) "
381 "nation \"%s\" (nb %d).",
396 ? &pruler_title->
male
410 ruler_titles =
new QHash<const struct nation_type *, struct ruler_title *>;
412 requirement_vector_init(&
reqs);
431 requirement_vector_free(&
reqs);
445 gov.item_number = i++;
struct player * city_owner(const struct city *pcity)
Return the owner of the city.
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
Returns the effect bonus for a player.
struct government * government_of_player(const struct player *pplayer)
Return the government of a player.
struct government * government_by_number(const Government_type_id gov)
Return the government with the given index.
const char * government_name_for_player(const struct player *pplayer)
Return the (translated) name of the given government of a player.
void governments_free()
De-allocate the currently allocated governments.
const struct nation_type * ruler_title_nation(const struct ruler_title *pruler_title)
Return the nation of the rule title.
bool untargeted_revolution_allowed()
Is it possible to start a revolution without specifying the target government in the current game?
Government_type_id government_count()
Return the number of governments.
const char * government_rule_name(const struct government *pgovern)
Return the (untranslated) rule name of the government.
struct government * government_of_city(const struct city *pcity)
Return the government of the player who owns the city.
const char * ruler_title_for_player(const struct player *pplayer, char *buf, size_t buf_len)
Return the ruler title of the player (translated).
QHash< const struct nation_type *, struct ruler_title * > * government_ruler_titles(const struct government *pgovern)
Returns all ruler titles for a government type.
static void ruler_title_destroy(struct ruler_title *pruler_title)
Free a ruler title.
const char * ruler_title_female_untranslated_name(const struct ruler_title *pruler_title)
Return the female rule title name.
const char * ruler_title_male_untranslated_name(const struct ruler_title *pruler_title)
Return the male rule title name.
struct government * government_by_rule_name(const char *name)
Returns the government that has the given (untranslated) rule name.
void governments_alloc(int num)
Allocate the governments.
struct ruler_title * government_ruler_title_new(struct government *pgovern, const struct nation_type *pnation, const char *ruler_male_title, const char *ruler_female_title)
Add a new ruler title for the nation.
std::vector< government > governments
bool can_change_to_government(struct player *pplayer, const struct government *gov)
Can change to government if appropriate tech exists, and one of:
static struct ruler_title * ruler_title_new(const struct nation_type *pnation, const char *domain, const char *ruler_male_title, const char *ruler_female_title)
Create a new ruler title.
Government_type_id government_number(const struct government *pgovern)
Return the government index.
Government_type_id government_index(const struct government *pgovern)
Return the government index.
static bool ruler_title_check(const struct ruler_title *pruler_title)
Return TRUE if the ruler title is valid.
const char * government_name_translation(const struct government *pgovern)
Return the (translated) name of the given government.
struct government * government_by_translated_name(const char *name)
Returns the government that has the given (translated) name.
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
static void name_set(struct name_translation *ptrans, const char *domain, const char *vernacular_name)
static const char * untranslated_name(const struct name_translation *ptrans)
static const char * rule_name_get(const struct name_translation *ptrans)
static const char * name_translation_get(const struct name_translation *ptrans)
const char * nation_rule_name(const struct nation_type *pnation)
Return the (untranslated) rule name of the nation (adjective form).
Nation_type_id nation_index(const struct nation_type *pnation)
Return the nation index.
struct nation_type * nation_of_player(const struct player *pplayer)
Return the nation of a player.
const char * player_name(const struct player *pplayer)
Return the leader name of the player.
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.
bool formats_match(const char *format1, const char *format2)
Returns TRUE iff both formats are compatible (if 'format1' can be used instead 'format2' and reciproc...
struct packet_ruleset_control control
struct packet_game_info info
struct requirement_vector reqs
Government_type_id item_number
QHash< const struct nation_type *, struct ruler_title * > * ruler_titles
struct government::@38 ai
QVector< QString > * helptext
struct name_translation name
~government()
De-allocate resources associated with the given government.
government()
Allocate resources associated with the given government.
char * translation_domain
struct government * government
struct name_translation male
struct name_translation female
const struct nation_type * pnation
int fc_snprintf(char *str, size_t n, const char *format,...)
See also fc_utf8_snprintf_trunc(), fc_utf8_snprintf_rep().
int fc_strcasecmp(const char *str0, const char *str1)
Compare strings like strcmp(), but ignoring case.