Freeciv-3.2
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 */
30 int attack; /* Units capable of attacking city */
31 int occupy; /* Units capable of occupying city */
32};
33
34struct 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
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 */
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
85 struct player *pplayer,
86 const struct city *pcity,
87 const struct impr_type *pimprove,
89 adv_want building_want);
90
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
107 const struct impr_type *pimprove);
108
110 enum effect_type effect_type,
111 const struct unit_type *utype);
112
113adv_want dai_city_want(struct player *pplayer, struct city *acity,
114 struct adv_data *adv, struct impr_type *pimprove);
115
116#endif /* FC__DAICITY_H */
char * incite_cost
Definition comments.c:75
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:156
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
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
void dai_manage_cities(struct ai_type *ait, struct player *pplayer)
Definition daicity.c:851
void dai_city_alloc(struct ai_type *ait, struct city *pcity)
Definition daicity.c:1111
void dai_consider_wonder_city(struct ai_type *ait, struct city *pcity, bool *result)
Definition daicity.c:2056
bool dai_can_player_build_improvement_later(const struct player *p, const struct impr_type *pimprove)
Definition daicity.c:2120
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:177
void dai_build_adv_adjust(struct ai_type *ait, struct player *pplayer, struct city *wonder_city)
Definition daicity.c:1945
void dai_city_free(struct ai_type *ait, struct city *pcity)
Definition daicity.c:1124
Impr_type_id dai_find_source_building(struct city *pcity, enum effect_type effect_type, const struct unit_type *utype)
Definition daicity.c:2156
void dai_build_adv_init(struct ai_type *ait, struct player *pplayer)
Definition daicity.c:1929
bool dai_can_city_build_improvement_later(const struct city *pcity, const struct impr_type *pimprove)
Definition daicity.c:2090
adv_want dai_city_want(struct player *pplayer, struct city *acity, struct adv_data *adv, struct impr_type *pimprove)
Definition daicity.c:1424
float adv_want
Definition fc_types.h:1354
int Impr_type_id
Definition fc_types.h:376
struct adv_choice choice
Definition daicity.h:41
bool founder_boat
Definition daicity.h:64
int building_wait
Definition daicity.h:38
bool celebrate
Definition daicity.h:57
int founder_turn
Definition daicity.h:65
bool has_diplomat
Definition daicity.h:59
unsigned int danger
Definition daicity.h:47
int founder_want
Definition daicity.h:66
int bcost
Definition daicity.h:44
unsigned int urgency
Definition daicity.h:49
int worker_want
Definition daicity.h:67
int building_turn
Definition daicity.h:37
int distance_to_wonder_city
Definition daicity.h:54
bool diplomat_threat
Definition daicity.h:58
adv_want worth
Definition daicity.h:35
int wallvalue
Definition daicity.h:51
int attack
Definition daicity.h:44
struct ai_invasion invasion
Definition daicity.h:43
unsigned int grave_danger
Definition daicity.h:48
struct unit_type * worker_type
Definition daicity.h:68
int attack
Definition daicity.h:30
int occupy
Definition daicity.h:31
Definition ai.h:50
Definition city.h:320