Freeciv21
Develop your civilization from humble roots to a global empire
infracache.h
Go to the documentation of this file.
1 /**************************************************************************
2  Copyright (c) 1996-2020 Freeciv21 and Freeciv contributors. This file is
3  __ __ part of Freeciv21. Freeciv21 is free software: you can
4 / \\..// \ redistribute it and/or modify it under the terms of the GNU
5  ( oo ) General Public License as published by the Free Software
6  \__/ Foundation, either version 3 of the License, or (at your
7  option) any later version. You should have received
8  a copy of the GNU General Public License along with Freeciv21. If not,
9  see https://www.gnu.org/licenses/.
10 **************************************************************************/
11 #pragma once
12 
13 /* server/advisors */
14 #include "advtools.h"
15 
16 struct player;
17 
18 struct adv_city {
19  /* Used for caching change in value from a worker performing
20  * a particular activity on a particular tile. */
23 
24  // building desirabilities - easiest to handle them here -- Syela
25  /* The units of building_want are output
26  * (shields/gold/luxuries) multiplied by a priority
27  * (SHIELD_WEIGHTING, etc or ai->shields_priority, etc)
28  */
30 
31  int downtown; /* distance from neighbours, for locating
32  wonders wisely */
33 };
34 
35 void adv_city_alloc(struct city *pcity);
36 void adv_city_free(struct city *pcity);
37 
38 void initialize_infrastructure_cache(struct player *pplayer);
39 
40 void adv_city_update(struct city *pcity);
41 
42 int city_tile_value(const struct city *pcity, const struct tile *ptile,
43  int foodneed, int prodneed);
44 
45 void adv_city_worker_act_set(struct city *pcity, int city_tile_index,
46  enum unit_activity act_id, int value);
47 int adv_city_worker_act_get(const struct city *pcity, int city_tile_index,
48  enum unit_activity act_id);
49 void adv_city_worker_extra_set(struct city *pcity, int city_tile_index,
50  const struct extra_type *pextra, int value);
51 int adv_city_worker_extra_get(const struct city *pcity, int city_tile_index,
52  const struct extra_type *pextra);
53 void adv_city_worker_rmextra_set(struct city *pcity, int city_tile_index,
54  const struct extra_type *pextra, int value);
55 int adv_city_worker_rmextra_get(const struct city *pcity,
56  int city_tile_index,
57  const struct extra_type *pextra);
float adv_want
Definition: fc_types.h:1144
#define B_LAST
Definition: improvement.h:33
void adv_city_free(struct city *pcity)
Free advisors related city data.
Definition: infracache.cpp:510
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: infracache.cpp:362
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: infracache.cpp:380
void adv_city_update(struct city *pcity)
Update the memory allocated for AI city handling.
Definition: infracache.cpp:472
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: infracache.cpp:434
void initialize_infrastructure_cache(struct player *pplayer)
Do all tile improvement calculations and cache them for later.
Definition: infracache.cpp:245
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: infracache.cpp:336
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: infracache.cpp:407
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: infracache.cpp:453
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.
Definition: infracache.cpp:305
void adv_city_alloc(struct city *pcity)
Allocate advisors related city data.
Definition: infracache.cpp:498
int downtown
Definition: infracache.h:31
adv_want building_want[B_LAST]
Definition: infracache.h:29
int act_cache_radius_sq
Definition: infracache.h:22
struct worker_activity_cache * act_cache
Definition: infracache.h:21
Definition: city.h:291
Definition: player.h:231
Definition: tile.h:42