Freeciv21
Develop your civilization from humble roots to a global empire
specialist.h File Reference
#include "shared.h"
#include "fc_types.h"
#include "name_translation.h"
#include "requirements.h"
+ Include dependency graph for specialist.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  specialist
 

Macros

#define DEFAULT_SPECIALIST   default_specialist
 
#define specialist_type_iterate(sp)
 
#define specialist_type_iterate_end
 
#define specialist_type_re_active_iterate(_p)
 
#define specialist_type_re_active_iterate_end
 

Functions

Specialist_type_id specialist_count ()
 Return the number of specialist_types. More...
 
Specialist_type_id specialist_index (const struct specialist *sp)
 Return the specialist index. More...
 
Specialist_type_id specialist_number (const struct specialist *sp)
 Return the specialist item_number. More...
 
struct specialistspecialist_by_number (const Specialist_type_id id)
 Return the specialist pointer for the given number. More...
 
struct specialistspecialist_by_rule_name (const char *name)
 Return the specialist type with the given (untranslated!) rule name. More...
 
struct specialistspecialist_by_translated_name (const char *name)
 Return the specialist type with the given (translated, plural) name. More...
 
const char * specialist_rule_name (const struct specialist *sp)
 Return the (untranslated) rule name of the specialist type. More...
 
const char * specialist_plural_translation (const struct specialist *sp)
 Return the (translated, plural) name of the specialist type. More...
 
const char * specialist_abbreviation_translation (const struct specialist *sp)
 Return the (translated) abbreviation of the specialist type. More...
 
const char * specialists_abbreviation_string ()
 Return a string containing all the specialist abbreviations, for instance "E/S/T". More...
 
const char * specialists_string (const citizens *specialist_list)
 Return a string showing the number of specialists in the array. More...
 
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. More...
 
void specialists_init ()
 Initialize data for specialists. More...
 
void specialists_free ()
 Free data for specialists. More...
 

Variables

struct specialist specialists [SP_MAX]
 
int default_specialist
 

Macro Definition Documentation

◆ DEFAULT_SPECIALIST

#define DEFAULT_SPECIALIST   default_specialist

Definition at line 37 of file specialist.h.

◆ specialist_type_iterate

#define specialist_type_iterate (   sp)
Value:
{ \
Specialist_type_id sp; \
\
for (sp = 0; sp < specialist_count(); sp++) {
Specialist_type_id specialist_count()
Return the number of specialist_types.
Definition: specialist.cpp:63

Definition at line 67 of file specialist.h.

◆ specialist_type_iterate_end

#define specialist_type_iterate_end
Value:
} \
}

Definition at line 73 of file specialist.h.

◆ specialist_type_re_active_iterate

#define specialist_type_re_active_iterate (   _p)
Value:
{ \
struct specialist *_p = specialist_by_number(_p##_); \
if (!_p->ruledit_disabled) {
#define _(String)
Definition: fcintl.h:50
#define specialist_type_iterate(sp)
Definition: specialist.h:67
struct specialist * specialist_by_number(const Specialist_type_id id)
Return the specialist pointer for the given number.
Definition: specialist.cpp:92

Definition at line 77 of file specialist.h.

◆ specialist_type_re_active_iterate_end

#define specialist_type_re_active_iterate_end
Value:
} \
} \
specialist_type_iterate_end;

Definition at line 83 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 218 of file specialist.cpp.

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 160 of file specialist.cpp.

Referenced by init_city_report_game_data(), and specialists_abbreviation_string().

◆ specialist_by_number()

◆ 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 104 of file specialist.cpp.

Referenced by sg_load_savefile(), and universal_by_number().

◆ 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 124 of file specialist.cpp.

Referenced by help_widget::set_topic_specialist().

◆ specialist_count()

Specialist_type_id specialist_count ( )

◆ specialist_index()

Specialist_type_id specialist_index ( const struct specialist sp)

Return the specialist index.

Currently same as specialist_number(), paired with specialist_count() indicates use as an array index.

Definition at line 74 of file specialist.cpp.

Referenced by cr_entry_specialist(), sg_load_player_city(), and sg_load_player_main().

◆ specialist_number()

Specialist_type_id specialist_number ( const struct specialist sp)

Return the specialist item_number.

Definition at line 83 of file specialist.cpp.

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 151 of file specialist.cpp.

Referenced by boot_help_texts(), get_city_dialog_size_text(), 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 142 of file specialist.cpp.

Referenced by 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 ( )

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 170 of file specialist.cpp.

Referenced by init_city_report_game_data().

◆ specialists_free()

void specialists_free ( )

Free data for specialists.

Definition at line 47 of file specialist.cpp.

Referenced by game_ruleset_free().

◆ specialists_init()

void specialists_init ( )

Initialize data for specialists.

Definition at line 30 of file specialist.cpp.

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 198 of file specialist.cpp.

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

Variable Documentation

◆ default_specialist

int default_specialist
extern

Definition at line 25 of file specialist.cpp.

◆ specialists

struct specialist specialists[SP_MAX]
extern