Freeciv-3.4
Loading...
Searching...
No Matches
Functions | Variables
specialist.c File Reference
#include "fcintl.h"
#include "log.h"
#include "string_vector.h"
#include "city.h"
#include "effects.h"
#include "game.h"
#include "specialist.h"

Go to the source code of this file.

Functions

void specialists_init (void)
 
void specialists_free (void)
 
Specialist_type_id specialist_count (void)
 
Specialist_type_id normal_specialist_count (void)
 
Specialist_type_id specialist_index (const struct specialist *sp)
 
Specialist_type_id specialist_number (const struct specialist *sp)
 
struct specialistspecialist_by_number (const Specialist_type_id id)
 
struct specialistspecialist_by_rule_name (const char *name)
 
struct specialistspecialist_by_translated_name (const char *name)
 
const charspecialist_rule_name (const struct specialist *sp)
 
const charspecialist_plural_translation (const struct specialist *sp)
 
const charspecialist_abbreviation_translation (const struct specialist *sp)
 
bool is_super_specialist_id (Specialist_type_id sp)
 
bool is_normal_specialist_id (Specialist_type_id sp)
 
bool is_super_specialist (const struct specialist *sp)
 
bool is_normal_specialist (const struct specialist *sp)
 
const charspecialists_abbreviation_string (void)
 
const charspecialists_string (const citizens *specialist_list)
 
int get_specialist_output (const struct city *pcity, Specialist_type_id sp, Output_type_id otype)
 

Variables

struct specialist specialists [SP_MAX]
 
int default_specialist
 

Function Documentation

◆ get_specialist_output()

int get_specialist_output ( const struct city pcity,
Specialist_type_id  sp,
Output_type_id  otype 
)

Return the output for the specialist type with this output type.

Definition at line 270 of file specialist.c.

Referenced by add_specialist_output(), best_specialist(), dai_set_defenders(), get_entertainers(), init_specialist_lattice_nodes(), and military_advisor_choose_build().

◆ is_normal_specialist()

bool is_normal_specialist ( const struct specialist sp)

If this is a normal specialist: included into city population, can be reassigned by player. Assumes a valid specialist pointer.

Definition at line 217 of file specialist.c.

◆ is_normal_specialist_id()

bool is_normal_specialist_id ( Specialist_type_id  sp)

If this is a normal specialist: included into city population, can be reassigned by player.

Definition at line 196 of file specialist.c.

Referenced by city_increase_size(), city_rotate_specialist(), handle_city_change_specialist(), handle_city_info(), is_normal_specialist(), package_city(), and sg_load_player_city().

◆ is_super_specialist()

bool is_super_specialist ( const struct specialist sp)

If this is a superspecialist: is not included into city population, is not controlled by player. Assumes a valid specialist pointer.

Definition at line 208 of file specialist.c.

Referenced by action_actor_utype_hard_reqs_ok_full(), api_edit_city_add_specialist(), api_methods_specialist_is_super(), city_add_unit(), dai_can_requirement_be_met_in_city(), expl_act_not_enabl(), helptext_specialist(), and helptext_unit().

◆ is_super_specialist_id()

bool is_super_specialist_id ( Specialist_type_id  sp)

If this is a superspecialist: is not included into city population, is not controlled by player.

Definition at line 184 of file specialist.c.

Referenced by actres_possible(), api_edit_city_reduce_specialists(), city_build(), is_super_specialist(), and save_cities_ruleset().

◆ normal_specialist_count()

Specialist_type_id normal_specialist_count ( void  )

Return the number of normal specialist_types.

Definition at line 79 of file specialist.c.

Referenced by api_edit_city_reduce_specialists(), apply_solution(), and city_rotate_specialist().

◆ specialist_abbreviation_translation()

const char * specialist_abbreviation_translation ( const struct specialist sp)

Return the (translated) abbreviation of the specialist type. You don't have to free the return pointer.

Definition at line 175 of file specialist.c.

Referenced by init_city_report_game_data(), and specialists_abbreviation_string().

◆ specialist_by_number()

struct specialist * specialist_by_number ( const Specialist_type_id  id)

◆ specialist_by_rule_name()

struct specialist * specialist_by_rule_name ( const char name)

Return the specialist type with the given (untranslated!) rule name. Returns nullptr if none match.

Definition at line 123 of file specialist.c.

Referenced by api_find_specialist_by_name(), load_ruleset_units(), sg_load_savefile(), sg_load_savefile(), and universal_value_from_str().

◆ specialist_by_translated_name()

struct specialist * specialist_by_translated_name ( const char name)

Return the specialist type with the given (translated, plural) name. Returns nullptr if none match.

Definition at line 141 of file specialist.c.

Referenced by help_update_specialist(), and help_widget::set_topic_specialist().

◆ specialist_count()

Specialist_type_id specialist_count ( void  )

◆ specialist_index()

Specialist_type_id specialist_index ( const struct specialist sp)

◆ specialist_number()

Specialist_type_id specialist_number ( const struct specialist sp)

Return the specialist item_number.

Definition at line 100 of file specialist.c.

Referenced by unit_goto_and_callback(), unit_goto_and_callback(), and universal_number().

◆ specialist_plural_translation()

const char * specialist_plural_translation ( const struct specialist sp)

Return the (translated, plural) name of the specialist type. You don't have to free the return pointer.

Definition at line 166 of file specialist.c.

Referenced by api_methods_specialist_name_translation(), boot_help_texts(), go_act_menu::create(), helptext_unit(), init_city_report_game_data(), real_menus_init(), real_menus_update(), req_text_insert(), specialist_by_translated_name(), and universal_name_translation().

◆ specialist_rule_name()

const char * specialist_rule_name ( const struct specialist sp)

◆ specialists_abbreviation_string()

const char * specialists_abbreviation_string ( void  )

Return a string containing all the specialist abbreviations, for instance "E/S/T". You don't have to free the return pointer.

Definition at line 227 of file specialist.c.

Referenced by cmafec_get_result_descr(), and init_city_report_game_data().

◆ specialists_free()

void specialists_free ( void  )

Free data for specialists.

Definition at line 53 of file specialist.c.

Referenced by game_ruleset_free().

◆ specialists_init()

void specialists_init ( void  )

Initialize data for specialists.

Definition at line 36 of file specialist.c.

Referenced by game_ruleset_init().

◆ specialists_string()

const char * specialists_string ( const citizens specialist_list)

Return a string showing the number of specialists in the array.

For instance with a city with (0,3,1) specialists call

specialists_string(pcity->specialists);

and you'll get "0/3/1".

Definition at line 252 of file specialist.c.

Referenced by cm_print_city(), cm_print_result(), cmafec_get_result_descr(), and cr_entry_specialists().

Variable Documentation

◆ default_specialist

int default_specialist

Definition at line 31 of file specialist.c.

Referenced by receive_packet_ruleset_game_100().

◆ specialists

struct specialist specialists[SP_MAX]