Freeciv-3.3: /fast/freeciv/nightly/main/ai/default/daidata.h Source File

Freeciv-3.3

Loading...
Searching...
No Matches
daidata.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 2002 - The Freeciv Project
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__DAIDATA_H
14#define FC__DAIDATA_H
15
16/* utility */
17#include "support.h"
18
19/* common */
20#include "fc_types.h"
21#include "tech.h"
22
23/* server */
24#include "srv_main.h" /* bv_id */
25
26/* server/advisors */
27#include "advtools.h"
28
29struct player;
30
31 enum winning_strategy {
32 WIN_OPEN, /* still undetermined */
33 WIN_WAR, /* we have no other choice than to crush all opposition */
34 WIN_SPACE, /* we will race for space, peace very important */
35 WIN_CAPITAL /* we cannot win unless we take war_target's capital */
36};
37
38#define SPECENUM_NAME war_reason
39#define SPECENUM_VALUE0 DAI_WR_BEHAVIOUR
40#define SPECENUM_VALUE0NAME "Behaviour"
41#define SPECENUM_VALUE1 DAI_WR_SPACE
42#define SPECENUM_VALUE1NAME "Space"
43#define SPECENUM_VALUE2 DAI_WR_EXCUSE
44#define SPECENUM_VALUE2NAME "Excuse"
45#define SPECENUM_VALUE3 DAI_WR_HATRED
46#define SPECENUM_VALUE3NAME "Hatred"
47#define SPECENUM_VALUE4 DAI_WR_ALLIANCE
48#define SPECENUM_VALUE4NAME "Alliance"
49#define SPECENUM_VALUE5 DAI_WR_NONE
50#define SPECENUM_VALUE5NAME "None"
51#include "specenum_gen.h"
52
53 struct ai_dip_intel {
54 /* Remember one example of each for text spam purposes. */
55 struct player *is_allied_with_enemy;
56 struct player *at_war_with_ally;
57 struct player *is_allied_with_ally;
58
59 signed char spam; /* timer to avoid spamming a player with chat */
60 int distance; /* average distance to that player's cities */
61 int countdown; /* we're on a countdown to war declaration */
62 enum war_reason war_reason; /* why we declare war */
63 signed char ally_patience; /* we EXPECT our allies to help us! */
64 signed char asked_about_peace; /* don't ask again */
65 signed char asked_about_alliance; /* don't nag! */
66 signed char asked_about_ceasefire; /* don't ... you get the point */
67 signed char warned_about_space;
68};
69
70 struct ai_plr
71{
72 bool phase_initialized;
73
74 int last_num_continents;
75 int last_num_oceans;
76
77 struct {
78 int passengers; /* Number of passengers waiting for boats */
79 int boats;
80 int available_boats;
81
82 int *workers; /* Cities to workers on continent */
83 int *ocean_workers;
84
85 bv_id diplomat_reservations;
86 } stats;
87
88 /* AI diplomacy and opinions on other players */
89 struct {
90 const struct ai_dip_intel **player_intel_slots;
91 enum winning_strategy strategy;
92 int timer; /* Pursue our goals with some stubbornness, in turns */
93 char love_coeff; /* Reduce love with this % each turn */
94 char love_incr; /* Modify love with this fixed amount */
95 int req_love_for_peace;
96 int req_love_for_alliance;
97 struct player *war_target;
98 } diplomacy;
99
100 /* Cache map for AI settlers; defined in daisettler.c. */
101 struct ai_settler *settler;
102
103 /* The units of tech_want seem to be shields */
104 adv_want tech_want[A_LAST+1];
105};
106
107void dai_data_init(struct ai_type *ait, struct player *pplayer);
108void dai_data_close(struct ai_type *ait, struct player *pplayer);
109
110void dai_data_phase_begin(struct ai_type *ait, struct player *pplayer,
111 bool is_new_phase);
112void dai_data_phase_finished(struct ai_type *ait, struct player *pplayer);
113bool is_ai_data_phase_open(struct ai_type *ait, struct player *pplayer);
114
115struct ai_plr *dai_plr_data_get(struct ai_type *ait, struct player *pplayer,
116 bool *caller_closes);
117
118struct ai_dip_intel *dai_diplomacy_get(struct ai_type *ait,
119 const struct player *plr1,
120 const struct player *plr2);
121
122void dai_gov_value(struct ai_type *ait, struct player *pplayer,
123 struct government *gov,
124 adv_want *val, bool *override);
125
126void dai_adjust_policies(struct ai_type *ait, struct player *pplayer);
127
128#endif /* FC__DAIDATA_H */
advtools.h
incite_cost
char * incite_cost
Definition comments.c:74
winning_strategy
winning_strategy
Definition daidata.h:31
WIN_SPACE
@ WIN_SPACE
Definition daidata.h:34
WIN_CAPITAL
@ WIN_CAPITAL
Definition daidata.h:35
WIN_OPEN
@ WIN_OPEN
Definition daidata.h:32
WIN_WAR
@ WIN_WAR
Definition daidata.h:33
is_ai_data_phase_open
bool is_ai_data_phase_open(struct ai_type *ait, struct player *pplayer)
Definition daidata.c:132
dai_gov_value
void dai_gov_value(struct ai_type *ait, struct player *pplayer, struct government *gov, adv_want *val, bool *override)
Definition daidata.c:524
dai_plr_data_get
struct ai_plr * dai_plr_data_get(struct ai_type *ait, struct player *pplayer, bool *caller_closes)
Definition daidata.c:308
dai_adjust_policies
void dai_adjust_policies(struct ai_type *ait, struct player *pplayer)
Definition daidata.c:442
dai_diplomacy_get
struct ai_dip_intel * dai_diplomacy_get(struct ai_type *ait, const struct player *plr1, const struct player *plr2)
Definition daidata.c:402
dai_data_init
void dai_data_init(struct ai_type *ait, struct player *pplayer)
Definition daidata.c:59
dai_data_phase_begin
void dai_data_phase_begin(struct ai_type *ait, struct player *pplayer, bool is_new_phase)
Definition daidata.c:142
dai_data_phase_finished
void dai_data_phase_finished(struct ai_type *ait, struct player *pplayer)
Definition daidata.c:285
dai_data_close
void dai_data_close(struct ai_type *ait, struct player *pplayer)
Definition daidata.c:104
fc_types.h
adv_want
float adv_want
Definition fc_types.h:1365
specenum_gen.h
srv_main.h
ai_dip_intel
Definition daidata.h:53
ai_dip_intel::at_war_with_ally
struct player * at_war_with_ally
Definition daidata.h:56
ai_dip_intel::asked_about_alliance
signed char asked_about_alliance
Definition daidata.h:65
ai_dip_intel::war_reason
enum war_reason war_reason
Definition daidata.h:62
ai_dip_intel::spam
signed char spam
Definition daidata.h:59
ai_dip_intel::asked_about_peace
signed char asked_about_peace
Definition daidata.h:64
ai_dip_intel::distance
int distance
Definition daidata.h:60
ai_dip_intel::is_allied_with_ally
struct player * is_allied_with_ally
Definition daidata.h:57
ai_dip_intel::warned_about_space
signed char warned_about_space
Definition daidata.h:67
ai_dip_intel::countdown
int countdown
Definition daidata.h:61
ai_dip_intel::ally_patience
signed char ally_patience
Definition daidata.h:63
ai_dip_intel::is_allied_with_enemy
struct player * is_allied_with_enemy
Definition daidata.h:55
ai_dip_intel::asked_about_ceasefire
signed char asked_about_ceasefire
Definition daidata.h:66
ai_plr
Definition daidata.h:71
ai_plr::passengers
int passengers
Definition daidata.h:78
ai_plr::ocean_workers
int * ocean_workers
Definition daidata.h:83
ai_plr::last_num_oceans
int last_num_oceans
Definition daidata.h:75
ai_plr::workers
int * workers
Definition daidata.h:82
ai_plr::last_num_continents
int last_num_continents
Definition daidata.h:74
ai_plr::phase_initialized
bool phase_initialized
Definition daidata.h:72
ai_plr::boats
int boats
Definition daidata.h:79
ai_plr::settler
struct ai_settler * settler
Definition daidata.h:101
ai_plr::tech_want
adv_want tech_want[A_LAST+1]
Definition daidata.h:104
ai_plr::req_love_for_alliance
int req_love_for_alliance
Definition daidata.h:96
ai_plr::timer
int timer
Definition daidata.h:92
ai_plr::love_incr
char love_incr
Definition daidata.h:94
ai_plr::love_coeff
char love_coeff
Definition daidata.h:93
ai_plr::diplomat_reservations
bv_id diplomat_reservations
Definition daidata.h:85
ai_plr::player_intel_slots
const struct ai_dip_intel ** player_intel_slots
Definition daidata.h:90
ai_plr::war_target
struct player * war_target
Definition daidata.h:97
ai_plr::available_boats
int available_boats
Definition daidata.h:80
ai_plr::diplomacy
struct ai_plr::@276 diplomacy
ai_plr::req_love_for_peace
int req_love_for_peace
Definition daidata.h:95
ai_plr::stats
struct ai_plr::@275 stats
ai_plr::strategy
enum winning_strategy strategy
Definition daidata.h:91
ai_settler
Definition daisettler.c:143
ai_type
Definition ai.h:50
government
Definition government.h:52
player
Definition player.h:249
support.h
tech.h
A_LAST
#define A_LAST
Definition tech.h:45