Freeciv-3.3
|
#include "city.h"
#include "game.h"
#include "map.h"
#include "player.h"
#include "tile.h"
#include "maphand.h"
#include "advbuilding.h"
#include "autoworkers.h"
#include "infracache.h"
Go to the source code of this file.
Data Structures | |
struct | worker_activity_cache |
Calculate the benefit of cultivating the given tile.
The return value is the goodness of the tile after the cultivating. This should be compared to the goodness of the tile currently. (see city_tile_value(); note that this depends on the AI's weighting values).
Definition at line 62 of file infracache.c.
Referenced by initialize_infrastructure_cache().
|
static |
Calculate the benefit of building an extra at the given tile.
The return value is the goodness of the tile after the extra is built. This should be compared to the goodness of the tile currently. (see city_tile_value(); note that this depends on the AI's weighting values).
This function does not calculate the benefit of being able to quickly move units (i.e., of connecting the civilization). See road_bonus() for that calculation.
Definition at line 188 of file infracache.c.
Referenced by initialize_infrastructure_cache().
Calculate the benefit of planting to the given tile.
The return value is the goodness of the tile after the planting. This should be compared to the goodness of the tile currently. (see city_tile_value(); note that this depends on the AI's weighting values).
Definition at line 102 of file infracache.c.
Referenced by initialize_infrastructure_cache().
|
static |
Calculate the benefit of removing an extra from the given tile.
The return value is the goodness of the tile after the extra is removed. This should be compared to the goodness of the tile currently. (see city_tile_value(); note that this depends on the AI's weighting values).
Definition at line 223 of file infracache.c.
Referenced by initialize_infrastructure_cache().
Calculate the benefit of transforming the given tile.
The return value is the goodness of the tile after the transform. This should be compared to the goodness of the tile currently. (see city_tile_value(); note that this depends on the AI's weighting values).
Definition at line 142 of file infracache.c.
Referenced by initialize_infrastructure_cache().
Allocate advisors related city data
Definition at line 489 of file infracache.c.
Referenced by create_city(), sg_load_player_cities(), sg_load_player_cities(), and texai_city_info_recv().
Free advisors related city data
Definition at line 502 of file infracache.c.
Referenced by remove_city(), server_game_free(), sg_load_player_cities(), sg_load_player_cities(), and texai_city_destruction_recv().
Update the memory allocated for AI city handling.
Definition at line 463 of file infracache.c.
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_want 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 360 of file infracache.c.
Referenced by texai_tile_worker_task_select(), and worker_evaluate_improvements().
void adv_city_worker_act_set | ( | struct city * | pcity, |
int | city_tile_index, | ||
enum unit_activity | act_id, | ||
adv_want | value | ||
) |
Set the value for activity 'doing' on tile 'city_tile_index' of city 'pcity'.
Definition at line 334 of file infracache.c.
Referenced by initialize_infrastructure_cache().
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 430 of file infracache.c.
Referenced by texai_tile_worker_task_select(), and worker_evaluate_improvements().
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 378 of file infracache.c.
Referenced by initialize_infrastructure_cache().
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 447 of file infracache.c.
Referenced by texai_tile_worker_task_select(), and worker_evaluate_improvements().
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 404 of file infracache.c.
Referenced by initialize_infrastructure_cache().
adv_want 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 303 of file infracache.c.
Referenced by adv_calc_cultivate(), adv_calc_extra(), adv_calc_plant(), adv_calc_rmextra(), adv_calc_transform(), texai_tile_worker_task_select(), and worker_evaluate_improvements().
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 250 of file infracache.c.
Referenced by auto_workers_player(), dai_do_build_city(), dai_manage_cities(), and texai_check_messages().