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

Go to the source code of this file.

Classes

struct  adv_city
 

Functions

void adv_city_alloc (struct city *pcity)
 Allocate advisors related city data. More...
 
void adv_city_free (struct city *pcity)
 Free advisors related city data. More...
 
void initialize_infrastructure_cache (struct player *pplayer)
 Do all tile improvement calculations and cache them for later. More...
 
void adv_city_update (struct city *pcity)
 Update the memory allocated for AI city handling. More...
 
int city_tile_value (const struct city *pcity, const struct tile *ptile, int foodneed, int prodneed)
 Returns a measure of goodness of a tile to pcity. More...
 
void adv_city_worker_act_set (struct city *pcity, int city_tile_index, enum unit_activity act_id, int value)
 Set the value for activity 'doing' on tile 'city_tile_index' of city 'pcity'. More...
 
int adv_city_worker_act_get (const struct city *pcity, int city_tile_index, enum unit_activity act_id)
 Return the value for activity 'doing' on tile 'city_tile_index' of city 'pcity'. More...
 
void adv_city_worker_extra_set (struct city *pcity, int city_tile_index, const struct extra_type *pextra, int value)
 Set the value for extra on tile 'city_tile_index' of city 'pcity'. More...
 
int adv_city_worker_extra_get (const struct city *pcity, int city_tile_index, const struct extra_type *pextra)
 Return the value for extra on tile 'city_tile_index' of city 'pcity'. More...
 
void adv_city_worker_rmextra_set (struct city *pcity, int city_tile_index, const struct extra_type *pextra, int value)
 Set the value for extra removal on tile 'city_tile_index' of city 'pcity'. More...
 
int adv_city_worker_rmextra_get (const struct city *pcity, int city_tile_index, const struct extra_type *pextra)
 Return the value for extra removal on tile 'city_tile_index' of city 'pcity'. More...
 

Function Documentation

◆ adv_city_alloc()

void adv_city_alloc ( struct city pcity)

Allocate advisors related city data.

Definition at line 498 of file infracache.cpp.

Referenced by create_city(), sg_load_player_cities(), and texai_city_info_recv().

◆ adv_city_free()

void adv_city_free ( struct city pcity)

Free advisors related city data.

Definition at line 510 of file infracache.cpp.

Referenced by remove_city(), server_game_free(), sg_load_player_cities(), and texai_city_destruction_recv().

◆ adv_city_update()

void adv_city_update ( struct city pcity)

Update the memory allocated for AI city handling.

Definition at line 472 of file infracache.cpp.

Referenced by adv_city_alloc(), adv_city_worker_act_set(), adv_city_worker_extra_set(), adv_city_worker_rmextra_set(), and city_map_update_radius_sq().

◆ adv_city_worker_act_get()

int adv_city_worker_act_get ( const struct city pcity,
int  city_tile_index,
enum unit_activity  act_id 
)

Return the value for activity 'doing' on tile 'city_tile_index' of city 'pcity'.

Definition at line 362 of file infracache.cpp.

Referenced by settler_evaluate_improvements(), tai_tile_worker_task_select(), and texai_tile_worker_task_select().

◆ adv_city_worker_act_set()

void adv_city_worker_act_set ( struct city pcity,
int  city_tile_index,
enum unit_activity  act_id,
int  value 
)

Set the value for activity 'doing' on tile 'city_tile_index' of city 'pcity'.

Definition at line 336 of file infracache.cpp.

Referenced by initialize_infrastructure_cache().

◆ adv_city_worker_extra_get()

int adv_city_worker_extra_get ( const struct city pcity,
int  city_tile_index,
const struct extra_type pextra 
)

Return the value for extra on tile 'city_tile_index' of city 'pcity'.

Definition at line 434 of file infracache.cpp.

Referenced by settler_evaluate_improvements(), tai_tile_worker_task_select(), and texai_tile_worker_task_select().

◆ adv_city_worker_extra_set()

void adv_city_worker_extra_set ( struct city pcity,
int  city_tile_index,
const struct extra_type pextra,
int  value 
)

Set the value for extra on tile 'city_tile_index' of city 'pcity'.

Definition at line 380 of file infracache.cpp.

Referenced by initialize_infrastructure_cache().

◆ adv_city_worker_rmextra_get()

int adv_city_worker_rmextra_get ( const struct city pcity,
int  city_tile_index,
const struct extra_type pextra 
)

Return the value for extra removal on tile 'city_tile_index' of city 'pcity'.

Definition at line 453 of file infracache.cpp.

Referenced by settler_evaluate_improvements(), tai_tile_worker_task_select(), and texai_tile_worker_task_select().

◆ adv_city_worker_rmextra_set()

void adv_city_worker_rmextra_set ( struct city pcity,
int  city_tile_index,
const struct extra_type pextra,
int  value 
)

Set the value for extra removal on tile 'city_tile_index' of city 'pcity'.

Definition at line 407 of file infracache.cpp.

Referenced by initialize_infrastructure_cache().

◆ city_tile_value()

int city_tile_value ( const struct city pcity,
const struct tile ptile,
int  foodneed,
int  prodneed 
)

Returns a measure of goodness of a tile to pcity.

FIXME: foodneed and prodneed are always 0.

Definition at line 305 of file infracache.cpp.

Referenced by adv_calc_extra(), adv_calc_irrigate_transform(), adv_calc_mine_transform(), adv_calc_rmextra(), adv_calc_transform(), settler_evaluate_improvements(), tai_tile_worker_task_select(), and texai_tile_worker_task_select().

◆ initialize_infrastructure_cache()

void initialize_infrastructure_cache ( struct player pplayer)

Do all tile improvement calculations and cache them for later.

These values are used in settler_evaluate_improvements() so this function must be called before doing that. Currently this is only done when handling auto-settlers or when the AI contemplates building worker units.

Definition at line 245 of file infracache.cpp.

Referenced by auto_settlers_player(), dai_do_build_city(), and dai_manage_cities().