Freeciv-3.4
Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
specialist.h File Reference
#include "shared.h"
#include "fc_types.h"
#include "name_translation.h"
#include "requirements.h"

Go to the source code of this file.

Data Structures

struct  specialist
 

Macros

#define DEFAULT_SPECIALIST   default_specialist
 
#define specialist_type_iterate(sp)
 
#define specialist_type_iterate_end
 
#define normal_specialist_type_iterate(sp)
 
#define normal_specialist_type_iterate_end
 
#define super_specialist_type_iterate(sp)
 
#define super_specialist_type_iterate_end
 
#define specialist_type_re_active_iterate(_p)
 
#define specialist_type_re_active_iterate_end
 

Functions

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 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)
 
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 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)
 
void specialists_init (void)
 
void specialists_free (void)
 

Variables

struct specialist specialists [SP_MAX]
 
int default_specialist
 

Macro Definition Documentation

◆ DEFAULT_SPECIALIST

#define DEFAULT_SPECIALIST   default_specialist

Definition at line 43 of file specialist.h.

◆ normal_specialist_type_iterate

#define normal_specialist_type_iterate (   sp)
Value:
{ \
char * incite_cost
Definition comments.c:77
int Specialist_type_id
Definition fc_types.h:236
Specialist_type_id normal_specialist_count(void)
Definition specialist.c:79

Definition at line 89 of file specialist.h.

◆ normal_specialist_type_iterate_end

#define normal_specialist_type_iterate_end
Value:
} \
}

Definition at line 95 of file specialist.h.

◆ specialist_type_iterate

#define specialist_type_iterate (   sp)
Value:
{ \
for (sp = 0; sp < specialist_count(); sp++) {
Specialist_type_id specialist_count(void)
Definition specialist.c:71

Definition at line 79 of file specialist.h.

◆ specialist_type_iterate_end

#define specialist_type_iterate_end
Value:
} \
}

Definition at line 85 of file specialist.h.

◆ specialist_type_re_active_iterate

#define specialist_type_re_active_iterate (   _p)
Value:
if (!_p->ruledit_disabled) {
#define _(String)
Definition fcintl.h:67
#define specialist_type_iterate(sp)
Definition specialist.h:79
struct specialist * specialist_by_number(const Specialist_type_id id)
Definition specialist.c:110

Definition at line 109 of file specialist.h.

◆ specialist_type_re_active_iterate_end

#define specialist_type_re_active_iterate_end
Value:
} \
#define specialist_type_iterate_end
Definition specialist.h:85

Definition at line 114 of file specialist.h.

◆ super_specialist_type_iterate

#define super_specialist_type_iterate (   sp)
Value:

Definition at line 99 of file specialist.h.

◆ super_specialist_type_iterate_end

#define super_specialist_type_iterate_end
Value:
} \
}

Definition at line 105 of file specialist.h.

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_specialist(), 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
extern

Definition at line 31 of file specialist.c.

Referenced by receive_packet_ruleset_game_100().

◆ specialists

struct specialist specialists[SP_MAX]
extern