Freeciv-3.1
|
#include <string.h>
#include "fciconv.h"
#include "fcintl.h"
#include "log.h"
#include "mem.h"
#include "support.h"
#include "game.h"
#include "specialist.h"
#include "attribute.h"
#include "agents.h"
#include "cma_fec.h"
#include "speclist.h"
Go to the source code of this file.
Data Structures | |
struct | cma_preset |
Macros | |
#define | RESULT_COLUMNS 10 |
#define | BUFFER_SIZE 100 |
#define | MAX_LEN_PRESET_NAME 80 |
#define | SPECLIST_TAG preset |
#define | SPECLIST_TYPE struct cma_preset |
#define | preset_list_iterate(presetlist, ppreset) TYPED_LIST_ITERATE(struct cma_preset, presetlist, ppreset) |
#define | preset_list_iterate_end LIST_ITERATE_END |
Functions | |
static void | city_remove (int city_id) |
void | cmafec_init (void) |
void | cmafec_free (void) |
void | cmafec_set_fe_parameter (struct city *pcity, const struct cm_parameter *const parameter) |
void | cmafec_get_fe_parameter (struct city *pcity, struct cm_parameter *dest) |
void | cmafec_preset_add (const char *descr_name, struct cm_parameter *pparam) |
void | cmafec_preset_remove (int idx) |
char * | cmafec_preset_get_descr (int idx) |
const struct cm_parameter * | cmafec_preset_get_parameter (int idx) |
int | cmafec_preset_get_index_of_parameter (const struct cm_parameter *const parameter) |
int | cmafec_preset_num (void) |
const char * | cmafec_get_short_descr_of_city (const struct city *pcity) |
const char * | cmafec_get_short_descr (const struct cm_parameter *const parameter) |
static const char * | get_city_growth_string (struct city *pcity, int surplus) |
static const char * | get_prod_complete_string (struct city *pcity, int surplus) |
const char * | cmafec_get_result_descr (struct city *pcity, const struct cm_result *result, const struct cm_parameter *const parameter) |
void | create_default_cma_presets (void) |
Variables | |
static struct preset_list * | preset_list = NULL |
#define preset_list_iterate | ( | presetlist, | |
ppreset | |||
) | TYPED_LIST_ITERATE(struct cma_preset, presetlist, ppreset) |
#define preset_list_iterate_end LIST_ITERATE_END |
#define SPECLIST_TYPE struct cma_preset |
|
static |
Is called if the game removes a city. It will clear the "fe parameter" attribute to reduce the size of the savegame.
Definition at line 68 of file cma_fec.c.
Referenced by cmafec_init().
void cmafec_free | ( | void | ) |
void cmafec_get_fe_parameter | ( | struct city * | pcity, |
struct cm_parameter * | dest | ||
) |
Return the front-end parameter for the given city. Returns a dummy parameter if no parameter was set.
Definition at line 115 of file cma_fec.c.
Referenced by button_press_callback(), button_press_callback(), cell_data_func(), cma_active_callback(), cma_preset_add_popup_callback(), create_cma_dialog(), hscale_changed(), popup_city_cma_dialog(), refresh_cma_dialog(), and city_dialog::update_cma_tab().
const char * cmafec_get_result_descr | ( | struct city * | pcity, |
const struct cm_result * | result, | ||
const struct cm_parameter *const | parameter | ||
) |
Return string describing result
Definition at line 322 of file cma_fec.c.
Referenced by refresh_cma_dialog(), and update_city_cma_dialog().
const char * cmafec_get_short_descr | ( | const struct cm_parameter *const | parameter | ) |
Returns the description of the matching preset or "custom" if no preset could be found.
Definition at line 236 of file cma_fec.c.
Referenced by cell_data_func(), cmafec_get_result_descr(), and cmafec_get_short_descr_of_city().
const char * cmafec_get_short_descr_of_city | ( | const struct city * | pcity | ) |
Return short description of city governor preset
Definition at line 221 of file cma_fec.c.
Referenced by cr_entry_cma(), city_map::paintEvent(), and city_dialog::update_cma_tab().
void cmafec_init | ( | void | ) |
Initialize the presets if there are no presets loaded on startup.
Definition at line 76 of file cma_fec.c.
Referenced by agents_init().
void cmafec_preset_add | ( | const char * | descr_name, |
struct cm_parameter * | pparam | ||
) |
Adds a preset.
Definition at line 136 of file cma_fec.c.
Referenced by cma_preset_add_popup_callback(), create_default_cma_presets(), ok_save_cma_callback(), and city_dialog::save_cma().
char * cmafec_preset_get_descr | ( | int | idx | ) |
Returns the indexed preset's description.
Definition at line 169 of file cma_fec.c.
Referenced by append_cma_to_menu_item(), cma_add_preset_callback(), cma_preset_remove(), city_dialog::cma_remove(), cmafec_get_short_descr(), create_governor_menu(), city_widget::gen_cma_labels(), popup_load_del_presets_dialog(), update_cma_preset_list(), and city_dialog::update_cma_tab().
int cmafec_preset_get_index_of_parameter | ( | const struct cm_parameter *const | parameter | ) |
Returns the index of the preset which matches the given parameter. Returns -1 if no preset could be found.
Definition at line 196 of file cma_fec.c.
Referenced by append_cma_to_menu_item(), cell_data_func(), cmafec_get_short_descr(), create_governor_menu(), select_cma_callback(), select_governor_callback(), and city_dialog::update_cma_tab().
const struct cm_parameter * cmafec_preset_get_parameter | ( | int | idx | ) |
Returns the indexed preset's parameter.
Definition at line 182 of file cma_fec.c.
Referenced by append_cma_to_menu_item(), cma_activate_preset_callback(), city_dialog::cma_double_clicked(), cma_iterate(), city_dialog::cma_selected(), create_governor_menu(), city_widget::display_list_menu(), governors_iterate(), ld_cma_callback(), popup_load_del_presets_dialog(), select_cma_callback(), select_governor_callback(), and city_dialog::update_sliders().
int cmafec_preset_num | ( | void | ) |
Returns the total number of presets.
Definition at line 213 of file cma_fec.c.
Referenced by append_cma_to_menu_item(), city_dialog::cma_remove(), city_dialog::cma_selected(), cmafec_free(), cmafec_preset_get_descr(), cmafec_preset_get_parameter(), cmafec_preset_remove(), create_governor_menu(), city_widget::gen_cma_labels(), popup_load_del_presets_dialog(), update_city_cma_dialog(), update_cma_preset_list(), city_dialog::update_cma_tab(), and city_dialog::update_sliders().
void cmafec_preset_remove | ( | int | idx | ) |
Removes a preset.
Definition at line 153 of file cma_fec.c.
Referenced by cma_preset_remove_response(), city_dialog::cma_remove(), cmafec_free(), ld_cma_callback(), and popup_load_del_presets_dialog().
void cmafec_set_fe_parameter | ( | struct city * | pcity, |
const struct cm_parameter *const | parameter | ||
) |
Sets the front-end parameter.
Definition at line 105 of file cma_fec.c.
Referenced by cma_activate_preset_callback(), cmafec_get_fe_parameter(), factor_horiz_cma_callback(), hscale_changed(), ld_cma_callback(), min_horiz_cma_callback(), popup_load_del_presets_dialog(), and toggle_cma_celebrating_callback().
void create_default_cma_presets | ( | void | ) |
|
static |
Return string describing when city is assumed to grow.
Definition at line 251 of file cma_fec.c.
Referenced by cmafec_get_result_descr().
|
static |
Return string describing when city is assumed to finish current production
Definition at line 285 of file cma_fec.c.
Referenced by cmafec_get_result_descr().
|
static |
Definition at line 62 of file cma_fec.c.
Referenced by cmafec_free(), cmafec_init(), cmafec_preset_add(), cmafec_preset_get_descr(), cmafec_preset_get_index_of_parameter(), cmafec_preset_get_parameter(), cmafec_preset_num(), and cmafec_preset_remove().