Freeciv-3.3
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 specialist_index (const struct specialist *sp)
 
Specialist_type_id specialist_number (const struct specialist *sp)
 
struct specialist * specialist_by_number (const Specialist_type_id id)
 
struct specialist * specialist_by_rule_name (const char *name)
 
struct specialist * specialist_by_translated_name (const char *name)
 
const char * specialist_rule_name (const struct specialist *sp)
 
const char * specialist_plural_translation (const struct specialist *sp)
 
const char * specialist_abbreviation_translation (const struct specialist *sp)
 
const char * specialists_abbreviation_string (void)
 
const char * specialists_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 217 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().

◆ 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 164 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 NULL if none match.

Definition at line 112 of file specialist.c.

Referenced by api_find_specialist_by_name(), 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 NULL if none match.

Definition at line 130 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 91 of file specialist.c.

Referenced by 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 155 of file specialist.c.

Referenced by api_methods_specialist_name_translation(), boot_help_texts(), init_city_report_game_data(), req_text_insert(), specialist_by_translated_name(), and universal_name_translation().

◆ specialist_rule_name()

const char * specialist_rule_name ( const struct specialist *  sp)

Return the (untranslated) rule name of the specialist type. You don't have to free the return pointer.

Definition at line 146 of file specialist.c.

Referenced by api_methods_specialist_rule_name(), compat_load_020600(), init_city_report_game_data(), is_universal_needed(), load_ruleset_cities(), sanity_check_ruleset_data(), sg_save_savefile(), specialist_by_rule_name(), universal_kind_values(), and universal_rule_name().

◆ 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 174 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 199 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]