Freeciv-3.2
Loading...
Searching...
No Matches
Data Structures | Functions
cm.h File Reference
#include "support.h"
#include "city.h"

Go to the source code of this file.

Data Structures

struct  cm_parameter
 
struct  cm_result
 

Functions

void cm_init (void)
 
void cm_init_citymap (void)
 
void cm_clear_cache (struct city *pcity)
 
void cm_free (void)
 
struct cm_resultcm_result_new (struct city *pcity)
 
void cm_result_destroy (struct cm_result *result)
 
void cm_query_result (struct city *pcity, const struct cm_parameter *const parameter, struct cm_result *result, bool negative_ok)
 
bool cm_are_parameter_equal (const struct cm_parameter *const p1, const struct cm_parameter *const p2)
 
void cm_copy_parameter (struct cm_parameter *dest, const struct cm_parameter *const src)
 
void cm_init_parameter (struct cm_parameter *dest)
 
void cm_init_emergency_parameter (struct cm_parameter *dest)
 
void cm_print_city (const struct city *pcity)
 
void cm_print_result (const struct cm_result *result)
 
int cm_result_citizens (const struct cm_result *result)
 
int cm_result_specialists (const struct cm_result *result)
 
int cm_result_workers (const struct cm_result *result)
 
void cm_result_from_main_map (struct cm_result *result, const struct city *pcity)
 

Function Documentation

◆ cm_are_parameter_equal()

bool cm_are_parameter_equal ( const struct cm_parameter *const  p1,
const struct cm_parameter *const  p2 
)

◆ cm_clear_cache()

void cm_clear_cache ( struct city pcity)

Clear the cache for a city.

Definition at line 322 of file cm.c.

Referenced by apply_result_on_server(), auto_arrange_workers(), city_changed(), and dai_manage_taxes().

◆ cm_copy_parameter()

void cm_copy_parameter ( struct cm_parameter dest,
const struct cm_parameter *const  src 
)

Copy the parameter from the source to the destination field.

Definition at line 2174 of file cm.c.

Referenced by begin_search(), cmafec_get_fe_parameter(), cmafec_preset_add(), handle_web_cma_set(), ld_cma_callback(), package_city(), popup_load_del_presets_dialog(), and city_dialog::update_sliders().

◆ cm_free()

void cm_free ( void  )

Called at the end of a game to free any CM data.

Definition at line 330 of file cm.c.

Referenced by game_free().

◆ cm_init()

void cm_init ( void  )

Initialize the CM data at the start of each game. Note the citymap indices will not have been initialized yet (cm_init_citymap is called when they are).

Definition at line 293 of file cm.c.

Referenced by game_init().

◆ cm_init_citymap()

void cm_init_citymap ( void  )

Initialize the CM citymap data. This function is called when the city map indices are generated (basically when the topology is set, shortly after the start of the game).

Definition at line 314 of file cm.c.

Referenced by generate_city_map_indices().

◆ cm_init_emergency_parameter()

void cm_init_emergency_parameter ( struct cm_parameter dest)

Initialize the parameter to sane default values that will always produce a result.

Definition at line 2201 of file cm.c.

Referenced by auto_arrange_workers().

◆ cm_init_parameter()

void cm_init_parameter ( struct cm_parameter dest)

Initialize the parameter to sane default values.

Definition at line 2183 of file cm.c.

Referenced by auto_arrange_workers(), cma_get_parameter(), cmafec_get_fe_parameter(), and dai_manage_taxes().

◆ cm_print_city()

void cm_print_city ( const struct city pcity)

Debugging routines. Print debugging information about one city.

Definition at line 2431 of file cm.c.

Referenced by apply_result_on_server(), and auto_arrange_workers().

◆ cm_print_result()

void cm_print_result ( const struct cm_result result)

Print debugging information about a full CM result.

Definition at line 2469 of file cm.c.

Referenced by apply_result_on_server(), and auto_arrange_workers().

◆ cm_query_result()

void cm_query_result ( struct city pcity,
const struct cm_parameter param,
struct cm_result result,
bool  negative_ok 
)

Wrapper that actually runs the branch & bound, and returns the best solution.

Definition at line 2122 of file cm.c.

Referenced by auto_arrange_workers(), dai_manage_taxes(), handle_city(), and run_cma_once_callback().

◆ cm_result_citizens()

int cm_result_citizens ( const struct cm_result result)

Count the total number of citizens in the result.

Definition at line 2252 of file cm.c.

Referenced by apply_result_on_server().

◆ cm_result_destroy()

void cm_result_destroy ( struct cm_result result)

◆ cm_result_from_main_map()

void cm_result_from_main_map ( struct cm_result result,
const struct city pcity 
)

Copy the city's current setup into the cm result structure. Wrapper for cm_result_main().

Definition at line 2261 of file cm.c.

Referenced by apply_result_on_server(), refresh_cma_dialog(), and update_city_cma_dialog().

◆ cm_result_new()

struct cm_result * cm_result_new ( struct city pcity)

◆ cm_result_specialists()

int cm_result_specialists ( const struct cm_result result)

Count the total number of specialists in the result.

Definition at line 2238 of file cm.c.

Referenced by cm_result_citizens(), and cmafec_get_result_descr().

◆ cm_result_workers()

int cm_result_workers ( const struct cm_result result)

Count the total number of workers in the result.

Definition at line 2218 of file cm.c.

Referenced by cm_print_result(), and cm_result_citizens().