Freeciv-3.1: /fast/freeciv/nightly/S3_1/server/advisors/infracache.h File Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Data Structures | Functions
infracache.h File Reference
`#include "advtools.h"`

Go to the source code of this file.

## Data Structures

struct | adv_city

## Functions

void | adv_city_alloc (struct city *pcity)
void | adv_city_free (struct city *pcity)
void | initialize_infrastructure_cache (struct player *pplayer)
void | adv_city_update (struct city *pcity)
adv_want | city_tile_value (const struct city *pcity, const struct tile *ptile, int foodneed, int prodneed)
void | adv_city_worker_act_set (struct city *pcity, int city_tile_index, enum unit_activity act_id, adv_want value)
adv_want | adv_city_worker_act_get (const struct city *pcity, int city_tile_index, enum unit_activity act_id)
void | adv_city_worker_extra_set (struct city *pcity, int city_tile_index, const struct extra_type *pextra, int value)
int | adv_city_worker_extra_get (const struct city *pcity, int city_tile_index, const struct extra_type *pextra)
void | adv_city_worker_rmextra_set (struct city *pcity, int city_tile_index, const struct extra_type *pextra, int value)
int | adv_city_worker_rmextra_get (const struct city *pcity, int city_tile_index, const struct extra_type *pextra)

## Function Documentation

## ◆ adv_city_alloc()

void adv_city_alloc | ( | struct city * | pcity | ) |

Allocate advisors related city data

Definition at line 488 of file infracache.c.

Referenced by create_city(), sg_load_player_cities(), 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 501 of file infracache.c.

Referenced by remove_city(), server_game_free(), sg_load_player_cities(), 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 462 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_city_worker_act_get()

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 359 of file infracache.c.

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,
|  | adv_want | value
| ) |  |

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

Definition at line 333 of file infracache.c.

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 429 of file infracache.c.

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 377 of file infracache.c.

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 446 of file infracache.c.

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 403 of file infracache.c.

Referenced by initialize_infrastructure_cache().

## ◆ city_tile_value()

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 302 of file infracache.c.

Referenced by adv_calc_cultivate(), adv_calc_extra(), adv_calc_plant(), 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 250 of file infracache.c.

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