Freeciv-3.1: /fast/freeciv/nightly/S3_1/ai/default/daicity.h Source File

Freeciv-3.1

Loading...
Searching...
No Matches
daicity.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13#ifndef FC__DAICITY_H
14#define FC__DAICITY_H
15
16/* common */
17#include "effects.h" /* enum effect_type */
18#include "fc_types.h"
19
20/* server/advisors */
21#include "advchoice.h"
22
23struct adv_data;
24struct tech_vector;
25
26struct ai_activity_cache; /* Defined and only used within daicity.c */
27
28/* Who's coming to kill us, for attack co-ordination */
29 struct ai_invasion {
30 int attack; /* Units capable of attacking city */
31 int occupy; /* Units capable of occupying city */
32};
33
34 struct ai_city {
35 adv_want worth; /* Cache city worth here, sum of all weighted incomes */
36
37 int building_turn; /* only recalculate every Nth turn */
38 int building_wait; /* for weighting values */
39#define BUILDING_WAIT_MINIMUM (1)
40
41 struct adv_choice choice; /* to spend gold in the right place only */
42
43 struct ai_invasion invasion;
44 int attack, bcost; /* This is also for invasion - total power and value of
45 * all units coming to kill us. */
46
47 unsigned int danger; /* danger to be compared to assess_defense */
48 unsigned int grave_danger; /* danger, should show positive feedback */
49 unsigned int urgency; /* how close the danger is; if zero,
50 bodyguards can leave */
51 int wallvalue; /* how much it helps for defenders to be
52 ground units */
53
54 int distance_to_wonder_city; /* wondercity will set this for us,
55 avoiding paradox */
56
57 bool celebrate; /* try to celebrate in this city */
58 bool diplomat_threat; /* enemy diplomat or spy is near the city */
59 bool has_diplomat; /* this city has diplomat or spy defender */
60
61 /* These values are for builder (UTYF_SETTLERS) and founder (UTYF_CITIES) units.
62 * Negative values indicate that the city needs a boat first;
63 * -value is the degree of want in that case. */
64 bool founder_boat; /* city founder will need a boat */
65 int founder_turn; /* only recalculate every Nth turn */
66 int founder_want;
67 int worker_want;
68 struct unit_type *worker_type;
69};
70
71void dai_manage_cities(struct ai_type *ait, struct player *pplayer);
72
73void dai_city_alloc(struct ai_type *ait, struct city *pcity);
74void dai_city_free(struct ai_type *ait, struct city *pcity);
75
76struct section_file;
77void dai_city_save(struct ai_type *ait, const char *aitstr,
78 struct section_file *file,
79 const struct city *pcity, const char *citystr);
80void dai_city_load(struct ai_type *ait, const char *aitstr,
81 const struct section_file *file,
82 struct city *pcity, const char *citystr);
83
84void want_techs_for_improvement_effect(struct ai_type *ait,
85 struct player *pplayer,
86 const struct city *pcity,
87 const struct impr_type *pimprove,
88 struct tech_vector *needed_techs,
89 adv_want building_want);
90
91void dont_want_tech_obsoleting_impr(struct ai_type *ait,
92 struct player *pplayer,
93 const struct city *pcity,
94 const struct impr_type *pimprove,
95 adv_want building_want);
96
97void dai_build_adv_init(struct ai_type *ait, struct player *pplayer);
98void dai_build_adv_adjust(struct ai_type *ait, struct player *pplayer,
99 struct city *wonder_city);
100
101void dai_consider_wonder_city(struct ai_type *ait, struct city *pcity, bool *result);
102
103bool dai_can_city_build_improvement_later(const struct city *pcity,
104 const struct impr_type *pimprove);
105bool
106 dai_can_player_build_improvement_later(const struct player *p,
107 const struct impr_type *pimprove);
108 Impr_type_id dai_find_source_building(struct city *pcity,
109 enum effect_type effect_type,
110 const struct unit_type *utype);
111
112 adv_want dai_city_want(struct player *pplayer, struct city *acity,
113 struct adv_data *adv, struct impr_type *pimprove);
114
115#endif /* FC__DAICITY_H */
advchoice.h
want_techs_for_improvement_effect
void want_techs_for_improvement_effect(struct ai_type *ait, struct player *pplayer, const struct city *pcity, const struct impr_type *pimprove, struct tech_vector *needed_techs, adv_want building_want)
Definition daicity.c:158
dai_city_save
void dai_city_save(struct ai_type *ait, const char *aitstr, struct section_file *file, const struct city *pcity, const char *citystr)
Definition daicity.c:1138
dai_city_load
void dai_city_load(struct ai_type *ait, const char *aitstr, const struct section_file *file, struct city *pcity, const char *citystr)
Definition daicity.c:1165
dai_manage_cities
void dai_manage_cities(struct ai_type *ait, struct player *pplayer)
Definition daicity.c:851
dai_city_alloc
void dai_city_alloc(struct ai_type *ait, struct city *pcity)
Definition daicity.c:1111
dai_consider_wonder_city
void dai_consider_wonder_city(struct ai_type *ait, struct city *pcity, bool *result)
Definition daicity.c:2050
dai_can_player_build_improvement_later
bool dai_can_player_build_improvement_later(const struct player *p, const struct impr_type *pimprove)
Definition daicity.c:2114
dont_want_tech_obsoleting_impr
void dont_want_tech_obsoleting_impr(struct ai_type *ait, struct player *pplayer, const struct city *pcity, const struct impr_type *pimprove, adv_want building_want)
Definition daicity.c:179
dai_build_adv_adjust
void dai_build_adv_adjust(struct ai_type *ait, struct player *pplayer, struct city *wonder_city)
Definition daicity.c:1935
dai_city_free
void dai_city_free(struct ai_type *ait, struct city *pcity)
Definition daicity.c:1124
dai_find_source_building
Impr_type_id dai_find_source_building(struct city *pcity, enum effect_type effect_type, const struct unit_type *utype)
Definition daicity.c:2150
dai_build_adv_init
void dai_build_adv_init(struct ai_type *ait, struct player *pplayer)
Definition daicity.c:1919
dai_can_city_build_improvement_later
bool dai_can_city_build_improvement_later(const struct city *pcity, const struct impr_type *pimprove)
Definition daicity.c:2083
dai_city_want
adv_want dai_city_want(struct player *pplayer, struct city *acity, struct adv_data *adv, struct impr_type *pimprove)
Definition daicity.c:1417
effects.h
fc_types.h
adv_want
float adv_want
Definition fc_types.h:1206
Impr_type_id
int Impr_type_id
Definition fc_types.h:346
adv_choice
Definition advchoice.h:45
adv_data
Definition advdata.h:45
ai_city
Definition daicity.h:34
ai_city::choice
struct adv_choice choice
Definition daicity.h:41
ai_city::founder_boat
bool founder_boat
Definition daicity.h:64
ai_city::building_wait
int building_wait
Definition daicity.h:38
ai_city::celebrate
bool celebrate
Definition daicity.h:57
ai_city::founder_turn
int founder_turn
Definition daicity.h:65
ai_city::has_diplomat
bool has_diplomat
Definition daicity.h:59
ai_city::danger
unsigned int danger
Definition daicity.h:47
ai_city::founder_want
int founder_want
Definition daicity.h:66
ai_city::bcost
int bcost
Definition daicity.h:44
ai_city::urgency
unsigned int urgency
Definition daicity.h:49
ai_city::worker_want
int worker_want
Definition daicity.h:67
ai_city::building_turn
int building_turn
Definition daicity.h:37
ai_city::distance_to_wonder_city
int distance_to_wonder_city
Definition daicity.h:54
ai_city::diplomat_threat
bool diplomat_threat
Definition daicity.h:58
ai_city::worth
adv_want worth
Definition daicity.h:35
ai_city::wallvalue
int wallvalue
Definition daicity.h:51
ai_city::attack
int attack
Definition daicity.h:44
ai_city::invasion
struct ai_invasion invasion
Definition daicity.h:43
ai_city::grave_danger
unsigned int grave_danger
Definition daicity.h:48
ai_city::worker_type
struct unit_type * worker_type
Definition daicity.h:68
ai_invasion
Definition daicity.h:29
ai_invasion::attack
int attack
Definition daicity.h:30
ai_invasion::occupy
int occupy
Definition daicity.h:31
ai_type
Definition ai.h:50
city
Definition city.h:309
impr_type
Definition improvement.h:68
player
Definition player.h:249
section_file
Definition section_file.h:36
unit_type
Definition unittype.h:481