Freeciv-3.1: /fast/freeciv/nightly/S3_1/common/specialist.c File Reference

Freeciv-3.1

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 | ) |

Return the specialist pointer for the given number.

Definition at line 100 of file specialist.c.

Referenced by boot_help_texts(), city_can_use_specialist(), compat_load_020600(), handle_ruleset_specialist(), init_city_report_game_data(), load_ruleset_cities(), save_cities_ruleset(), send_ruleset_specialists(), sg_save_savefile(), specialist_by_rule_name(), specialist_by_translated_name(), specialists_abbreviation_string(), tileset_setup_specialist_type(), universal_by_number(), and universal_value_initial().

## ◆ 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 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 |  | ) |

Return the number of specialist_types.

Definition at line 71 of file specialist.c.

Referenced by city_rotate_specialist(), compat_load_020600(), handle_city_change_specialist(), init_city_report_game_data(), package_city(), redraw_city_dialog(), redraw_happiness_city_dialog(), reload_small_citizens_icons(), sg_save_savefile(), and tilespec_free_city_icons().

## ◆ 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 82 of file specialist.c.

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

## ◆ 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 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 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]

Definition at line 30 of file specialist.c.

Referenced by fc_results_are_equal(), get_specialist_output(), receive_packet_city_info_100(), receive_packet_city_info_101(), receive_packet_city_info_102(), receive_packet_city_info_103(), receive_packet_edit_city_100(), receive_packet_edit_city_101(), specialist_by_number(), specialist_index(), specialists_free(), and specialists_init().