Freeciv-3.2
Loading...
Searching...
No Matches
classicai.c
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
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* common */
19#include "ai.h"
20#include "player.h"
21
22/* server/advisors */
23#include "advdata.h"
24#include "autosettlers.h"
25
26/* ai/default */
27#include "aiferry.h"
28#include "aihand.h"
29#include "aitools.h"
30#include "daicity.h"
31#include "daidata.h"
32#include "daidiplomacy.h"
33#include "daidomestic.h"
34#include "dailog.h"
35#include "daimilitary.h"
36#include "daiplayer.h"
37#include "daisettler.h"
38
39#include "classicai.h"
40
41/* This function is only needed as symbol in module. Nevertheless
42 gcc requires that there is prior prototype. */
43const char *fc_ai_classic_capstr(void);
44
45static struct ai_type *self = NULL;
46
47/**********************************************************************/
50static void classic_ai_set_self(struct ai_type *ai)
51{
52 self = ai;
53}
54
55/**********************************************************************/
58static struct ai_type *classic_ai_get_self(void)
59{
60 return self;
61}
62
63/**********************************************************************/
66const char *fc_ai_classic_capstr(void)
67{
68 return FC_AI_MOD_CAPSTR;
69}
70
71/**********************************************************************/
74static void cai_module_close(void)
75{
76 struct ai_type *deftype = classic_ai_get_self();
77
78 FC_FREE(deftype->private);
79}
80
81/**********************************************************************/
84static void cai_player_alloc(struct player *pplayer)
85{
86 struct ai_type *deftype = classic_ai_get_self();
87
88 dai_player_alloc(deftype, pplayer);
89}
90
91/**********************************************************************/
94static void cai_player_free(struct player *pplayer)
95{
96 struct ai_type *deftype = classic_ai_get_self();
97
98 dai_player_free(deftype, pplayer);
99}
100
101/**********************************************************************/
105static void cai_player_save_relations(struct player *pplayer,
106 struct player *other,
107 struct section_file *file,
108 int plrno)
109{
110 struct ai_type *deftype = classic_ai_get_self();
111
112 dai_player_save_relations(deftype, "ai", pplayer, other, file, plrno);
113}
114
115/**********************************************************************/
118static void cai_player_load_relations(struct player *pplayer,
119 struct player *other,
120 const struct section_file *file,
121 int plrno)
122{
123 struct ai_type *deftype = classic_ai_get_self();
124
125 dai_player_load_relations(deftype, "ai", pplayer, other, file, plrno);
126}
127
128/**********************************************************************/
131static void cai_gained_control(struct player *pplayer)
132{
133 struct ai_type *deftype = classic_ai_get_self();
134
135 dai_gained_control(deftype, pplayer);
136}
137
138/**********************************************************************/
141static void cai_split_by_civil_war(struct player *original,
142 struct player *created)
143{
144 struct ai_type *deftype = classic_ai_get_self();
145
146 dai_assess_danger_player(deftype, &(wld.map), original);
147}
148
149/**********************************************************************/
152static void cai_created_by_civil_war(struct player *original,
153 struct player *created)
154{
155 struct ai_type *deftype = classic_ai_get_self();
156
157 dai_player_copy(deftype, original, created);
158}
159
160/**********************************************************************/
163static void cai_data_phase_begin(struct player *pplayer, bool is_new_phase)
164{
165 struct ai_type *deftype = classic_ai_get_self();
166
167 dai_data_phase_begin(deftype, pplayer, is_new_phase);
168}
169
170/**********************************************************************/
173static void cai_data_phase_finished(struct player *pplayer)
174{
175 struct ai_type *deftype = classic_ai_get_self();
176
177 dai_data_phase_finished(deftype, pplayer);
178}
179
180/**********************************************************************/
183static void cai_city_alloc(struct city *pcity)
184{
185 struct ai_type *deftype = classic_ai_get_self();
186
187 dai_city_alloc(deftype, pcity);
188}
189
190/**********************************************************************/
193static void cai_city_free(struct city *pcity)
194{
195 struct ai_type *deftype = classic_ai_get_self();
196
197 dai_city_free(deftype, pcity);
198}
199
200/**********************************************************************/
203static void cai_city_save(struct section_file *file, const struct city *pcity,
204 const char *citystr)
205{
206 struct ai_type *deftype = classic_ai_get_self();
207
208 dai_city_save(deftype, "ai", file, pcity, citystr);
209}
210
211/**********************************************************************/
214static void cai_city_load(const struct section_file *file, struct city *pcity,
215 const char *citystr)
216{
217 struct ai_type *deftype = classic_ai_get_self();
218
219 dai_city_load(deftype, "ai", file, pcity, citystr);
220}
221
222/**********************************************************************/
225static void cai_build_adv_override(struct city *pcity, struct adv_choice *choice)
226{
227 struct ai_type *deftype = classic_ai_get_self();
228
229 dai_build_adv_override(deftype, pcity, choice);
230}
231
232/**********************************************************************/
235static void cai_wonder_city_distance(struct player *pplayer, struct adv_data *adv)
236{
237 struct ai_type *deftype = classic_ai_get_self();
238
239 dai_wonder_city_distance(deftype, pplayer, adv);
240}
241
242/**********************************************************************/
245static void cai_build_adv_init(struct player *pplayer)
246{
247 struct ai_type *deftype = classic_ai_get_self();
248
249 dai_build_adv_init(deftype, pplayer);
250}
251
252/**********************************************************************/
255static void cai_build_adv_adjust(struct player *pplayer, struct city *wonder_city)
256{
257 struct ai_type *deftype = classic_ai_get_self();
258
259 dai_build_adv_adjust(deftype, pplayer, wonder_city);
260}
261
262/**********************************************************************/
265static void cai_gov_value(struct player *pplayer, struct government *gov,
266 adv_want *val, bool *override)
267{
268 struct ai_type *deftype = classic_ai_get_self();
269
270 dai_gov_value(deftype, pplayer, gov, val, override);
271}
272
273/**********************************************************************/
276static void cai_units_ruleset_init(void)
277{
278 struct ai_type *deftype = classic_ai_get_self();
279
280 dai_units_ruleset_init(deftype);
281}
282
283/**********************************************************************/
286static void cai_units_ruleset_close(void)
287{
288 struct ai_type *deftype = classic_ai_get_self();
289
291}
292
293/**********************************************************************/
296static void cai_unit_init(struct unit *punit)
297{
298 struct ai_type *deftype = classic_ai_get_self();
299
300 dai_unit_init(deftype, punit);
301}
302
303/**********************************************************************/
306static void cai_unit_close(struct unit *punit)
307{
308 struct ai_type *deftype = classic_ai_get_self();
309
310 dai_unit_close(deftype, punit);
311}
312
313/**********************************************************************/
316static void cai_ferry_init_ferry(struct unit *ferry)
317{
318 struct ai_type *deftype = classic_ai_get_self();
319
320 dai_ferry_init_ferry(deftype, ferry);
321}
322
323/**********************************************************************/
326static void cai_ferry_transformed(struct unit *ferry, const struct unit_type *old)
327{
328 struct ai_type *deftype = classic_ai_get_self();
329
330 dai_ferry_transformed(deftype, ferry, old);
331}
332
333/**********************************************************************/
336static void cai_ferry_lost(struct unit *punit)
337{
338 struct ai_type *deftype = classic_ai_get_self();
339
340 dai_ferry_lost(deftype, punit);
341}
342
343/**********************************************************************/
346static void cai_unit_turn_end(struct unit *punit)
347{
348 struct ai_type *deftype = classic_ai_get_self();
349
350 dai_unit_turn_end(deftype, punit);
351}
352
353/**********************************************************************/
356static void cai_unit_move_or_attack(struct unit *punit, struct tile *ptile,
357 struct pf_path *path, int step)
358{
359 struct ai_type *deftype = classic_ai_get_self();
360
361 dai_unit_move_or_attack(deftype, punit, ptile, path, step);
362}
363
364/**********************************************************************/
367static void cai_unit_new_adv_task(struct unit *punit, enum adv_unit_task task,
368 struct tile *ptile)
369{
370 struct ai_type *deftype = classic_ai_get_self();
371
372 dai_unit_new_adv_task(deftype, punit, task, ptile);
373}
374
375/**********************************************************************/
378static void cai_unit_save(struct section_file *file, const struct unit *punit,
379 const char *unitstr)
380{
381 struct ai_type *deftype = classic_ai_get_self();
382
383 dai_unit_save(deftype, "", file, punit, unitstr);
384}
385
386/**********************************************************************/
389static void cai_unit_load(const struct section_file *file, struct unit *punit,
390 const char *unitstr)
391{
392 struct ai_type *deftype = classic_ai_get_self();
393
394 dai_unit_load(deftype, "", file, punit, unitstr);
395}
396
397/**********************************************************************/
400static void cai_auto_settler_reset(struct player *pplayer)
401{
402 struct ai_type *deftype = classic_ai_get_self();
403
404 dai_auto_settler_reset(deftype, pplayer);
405}
406
407/**********************************************************************/
410static void cai_auto_settler_run(struct player *pplayer,
411 struct unit *punit,
412 struct settlermap *state)
413{
414 struct ai_type *deftype = classic_ai_get_self();
415
416 dai_auto_settler_run(deftype, &(wld.map), pplayer, punit, state);
417}
418
419/**********************************************************************/
422static void cai_auto_settler_cont(struct player *pplayer,
423 struct unit *punit,
424 struct settlermap *state)
425{
426 struct ai_type *deftype = classic_ai_get_self();
427
428 dai_auto_settler_cont(deftype, &(wld.map), pplayer, punit, state);
429}
430
431/**********************************************************************/
434static void cai_switch_to_explore(struct unit *punit, struct tile *target,
435 enum override_bool *allow)
436{
437 struct ai_type *deftype = classic_ai_get_self();
438
439 dai_switch_to_explore(deftype, punit, target, allow);
440}
441
442/**********************************************************************/
445static void cai_do_first_activities(struct player *pplayer)
446{
447 struct ai_type *deftype = classic_ai_get_self();
448
449 dai_do_first_activities(deftype, pplayer);
450
451 pplayer->ai_phase_done = TRUE;
452}
453
454/**********************************************************************/
457static void cai_restart_phase(struct player *pplayer)
458{
459 pplayer->ai_phase_done = TRUE;
460}
461
462/**********************************************************************/
465static void cai_diplomacy_actions(struct player *pplayer)
466{
467 struct ai_type *deftype = classic_ai_get_self();
468
469 dai_diplomacy_actions(deftype, pplayer);
470}
471
472/**********************************************************************/
475static void cai_do_last_activities(struct player *pplayer)
476{
477 struct ai_type *deftype = classic_ai_get_self();
478
479 dai_do_last_activities(deftype, pplayer);
480}
481
482/**********************************************************************/
485static void cai_treaty_evaluate(struct player *pplayer, struct player *aplayer,
486 struct Treaty *ptreaty)
487{
488 struct ai_type *deftype = classic_ai_get_self();
489
490 dai_treaty_evaluate(deftype, pplayer, aplayer, ptreaty);
491}
492
493/**********************************************************************/
496static void cai_treaty_accepted(struct player *pplayer, struct player *aplayer,
497 struct Treaty *ptreaty)
498{
499 struct ai_type *deftype = classic_ai_get_self();
500
501 dai_treaty_accepted(deftype, pplayer, aplayer, ptreaty);
502}
503
504/**********************************************************************/
507static void cai_diplomacy_first_contact(struct player *pplayer,
508 struct player *aplayer)
509{
510 struct ai_type *deftype = classic_ai_get_self();
511
512 dai_diplomacy_first_contact(deftype, pplayer, aplayer);
513}
514
515/**********************************************************************/
519 enum casus_belli_range scope,
520 const struct action *paction,
521 struct player *receiver,
522 struct player *violator, struct player *victim)
523{
524 struct ai_type *deftype = classic_ai_get_self();
525
526 dai_incident(deftype, type, scope, paction, receiver, violator, victim);
527}
528
529/**********************************************************************/
532static void cai_city_log(char *buffer, int buflength, const struct city *pcity)
533{
534 struct ai_type *deftype = classic_ai_get_self();
535
536 dai_city_log(deftype, buffer, buflength, pcity);
537}
538
539/**********************************************************************/
542static void cai_unit_log(char *buffer, int buflength, const struct unit *punit)
543{
544 struct ai_type *deftype = classic_ai_get_self();
545
546 dai_unit_log(deftype, buffer, buflength, punit);
547}
548
549/**********************************************************************/
552static void cai_consider_plr_dangerous(struct player *plr1, struct player *plr2,
553 enum override_bool *result)
554{
555 struct ai_type *deftype = classic_ai_get_self();
556
557 dai_consider_plr_dangerous(deftype, plr1, plr2, result);
558}
559
560/**********************************************************************/
563static void cai_consider_tile_dangerous(struct tile *ptile, struct unit *punit,
564 enum override_bool *result)
565{
566 struct ai_type *deftype = classic_ai_get_self();
567
568 dai_consider_tile_dangerous(deftype, ptile, punit, result);
569}
570
571/**********************************************************************/
574static void cai_consider_wonder_city(struct city *pcity, bool *result)
575{
576 struct ai_type *deftype = classic_ai_get_self();
577
578 dai_consider_wonder_city(deftype, pcity, result);
579}
580
581/**********************************************************************/
584static void cai_revolution_start(struct player *pplayer)
585{
586 struct ai_type *deftype = classic_ai_get_self();
587
588 dai_revolution_start(deftype, pplayer);
589}
590
591/**********************************************************************/
595{
596 struct dai_private_data *private;
597
599
600 strncpy(ai->name, "classic", sizeof(ai->name));
601
602 private = fc_malloc(sizeof(struct dai_private_data));
603 private->contemplace_workers = TRUE;
604 ai->private = private;
605
607
608 /* ai->funcs.map_alloc = NULL; */
609 /* ai->funcs.map_ready = NULL; */
610 /* ai->funcs.map_free = NULL; */
611 /* ai->funcs.game_start = NULL; */
612 /* ai->funcs.game_free = NULL; */
613
616 /* ai->funcs.player_save = NULL; */
617 /* ai->funcs.player_load = NULL; */
621 /* ai->funcs.lost_control = NULL; */
624
627
630 /*
631 ai->funcs.city_created = NULL;
632 ai->funcs.city_destroyed = NULL;
633 ai->funcs.city_got = NULL;
634 ai->funcs.city_lost = NULL;
635 */
642
644
647
648 /* FIXME: We should allocate memory only for units owned by
649 default ai in unit_got. We track no data
650 about enemy units.
651 But advisors code still depends on some default ai data (role) to be
652 always allocated. */
653 /*
654 ai->funcs.unit_alloc = NULL;
655 ai->funcs.unit_free = NULL;
656 ai->funcs.unit_created = NULL;
657 ai->funcs.unit_destroyed = NULL;
658 ai->funcs.unit_got = dai_unit_init;
659 ai->funcs.unit_lost = dai_unit_close;
660 */
666
669 /* ai->funcs.unit_move_seen = NULL; */
671
674
678
680
689
692
696
697 /* ai->funcs.refresh = NULL; */
698
699 /* ai->funcs.tile_info = NULL; */
700 /* ai->funcs.city_info = NULL; */
701 /* ai->funcs.unit_info = NULL; */
702
704
705 return TRUE;
706}
#define FC_AI_MOD_CAPSTR
Definition ai.h:27
incident_type
Definition ai.h:45
void dai_ferry_lost(struct ai_type *ait, struct unit *punit)
Definition aiferry.c:221
void dai_ferry_transformed(struct ai_type *ait, struct unit *ferry, const struct unit_type *old)
Definition aiferry.c:189
void dai_ferry_init_ferry(struct ai_type *ait, struct unit *ferry)
Definition aiferry.c:167
void dai_do_last_activities(struct ai_type *ait, struct player *pplayer)
Definition aihand.c:774
void dai_do_first_activities(struct ai_type *ait, struct player *pplayer)
Definition aihand.c:748
void dai_build_adv_override(struct ai_type *ait, struct city *pcity, struct adv_choice *choice)
Definition aitools.c:1369
void dai_consider_plr_dangerous(struct ai_type *ait, struct player *plr1, struct player *plr2, enum override_bool *result)
Definition aitools.c:142
void dai_unit_new_adv_task(struct ai_type *ait, struct unit *punit, enum adv_unit_task task, struct tile *ptile)
Definition aitools.c:620
void dai_unit_move_or_attack(struct ai_type *ait, struct unit *punit, struct tile *ptile, struct pf_path *path, int step)
Definition aitools.c:1067
static void cai_restart_phase(struct player *pplayer)
Definition classicai.c:457
static void cai_city_log(char *buffer, int buflength, const struct city *pcity)
Definition classicai.c:532
static void cai_ferry_lost(struct unit *punit)
Definition classicai.c:336
static void cai_city_free(struct city *pcity)
Definition classicai.c:193
static void cai_player_load_relations(struct player *pplayer, struct player *other, const struct section_file *file, int plrno)
Definition classicai.c:118
static void cai_module_close(void)
Definition classicai.c:74
const char * fc_ai_classic_capstr(void)
Definition classicai.c:66
static void cai_units_ruleset_init(void)
Definition classicai.c:276
static void cai_city_alloc(struct city *pcity)
Definition classicai.c:183
static void cai_wonder_city_distance(struct player *pplayer, struct adv_data *adv)
Definition classicai.c:235
static void cai_build_adv_adjust(struct player *pplayer, struct city *wonder_city)
Definition classicai.c:255
static struct ai_type * classic_ai_get_self(void)
Definition classicai.c:58
static void cai_diplomacy_first_contact(struct player *pplayer, struct player *aplayer)
Definition classicai.c:507
static void cai_units_ruleset_close(void)
Definition classicai.c:286
static void cai_unit_save(struct section_file *file, const struct unit *punit, const char *unitstr)
Definition classicai.c:378
static void cai_do_last_activities(struct player *pplayer)
Definition classicai.c:475
static void cai_unit_turn_end(struct unit *punit)
Definition classicai.c:346
static void cai_player_alloc(struct player *pplayer)
Definition classicai.c:84
static void cai_created_by_civil_war(struct player *original, struct player *created)
Definition classicai.c:152
static void cai_switch_to_explore(struct unit *punit, struct tile *target, enum override_bool *allow)
Definition classicai.c:434
static void cai_gov_value(struct player *pplayer, struct government *gov, adv_want *val, bool *override)
Definition classicai.c:265
bool fc_ai_classic_setup(struct ai_type *ai)
Definition classicai.c:594
static void cai_data_phase_finished(struct player *pplayer)
Definition classicai.c:173
static void cai_ferry_init_ferry(struct unit *ferry)
Definition classicai.c:316
static void cai_auto_settler_run(struct player *pplayer, struct unit *punit, struct settlermap *state)
Definition classicai.c:410
static void cai_unit_init(struct unit *punit)
Definition classicai.c:296
static void cai_diplomacy_actions(struct player *pplayer)
Definition classicai.c:465
static void cai_build_adv_init(struct player *pplayer)
Definition classicai.c:245
static void cai_data_phase_begin(struct player *pplayer, bool is_new_phase)
Definition classicai.c:163
static void cai_incident(enum incident_type type, enum casus_belli_range scope, const struct action *paction, struct player *receiver, struct player *violator, struct player *victim)
Definition classicai.c:518
static void cai_consider_tile_dangerous(struct tile *ptile, struct unit *punit, enum override_bool *result)
Definition classicai.c:563
static void cai_unit_move_or_attack(struct unit *punit, struct tile *ptile, struct pf_path *path, int step)
Definition classicai.c:356
static void cai_do_first_activities(struct player *pplayer)
Definition classicai.c:445
static void cai_gained_control(struct player *pplayer)
Definition classicai.c:131
static void cai_revolution_start(struct player *pplayer)
Definition classicai.c:584
static void cai_build_adv_override(struct city *pcity, struct adv_choice *choice)
Definition classicai.c:225
static void cai_city_load(const struct section_file *file, struct city *pcity, const char *citystr)
Definition classicai.c:214
static void cai_unit_log(char *buffer, int buflength, const struct unit *punit)
Definition classicai.c:542
static void cai_treaty_accepted(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition classicai.c:496
static void cai_ferry_transformed(struct unit *ferry, const struct unit_type *old)
Definition classicai.c:326
static void cai_consider_wonder_city(struct city *pcity, bool *result)
Definition classicai.c:574
static struct ai_type * self
Definition classicai.c:45
static void cai_unit_load(const struct section_file *file, struct unit *punit, const char *unitstr)
Definition classicai.c:389
static void cai_treaty_evaluate(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition classicai.c:485
static void classic_ai_set_self(struct ai_type *ai)
Definition classicai.c:50
static void cai_player_free(struct player *pplayer)
Definition classicai.c:94
static void cai_player_save_relations(struct player *pplayer, struct player *other, struct section_file *file, int plrno)
Definition classicai.c:105
static void cai_consider_plr_dangerous(struct player *plr1, struct player *plr2, enum override_bool *result)
Definition classicai.c:552
static void cai_unit_new_adv_task(struct unit *punit, enum adv_unit_task task, struct tile *ptile)
Definition classicai.c:367
static void cai_auto_settler_cont(struct player *pplayer, struct unit *punit, struct settlermap *state)
Definition classicai.c:422
static void cai_auto_settler_reset(struct player *pplayer)
Definition classicai.c:400
static void cai_split_by_civil_war(struct player *original, struct player *created)
Definition classicai.c:141
static void cai_city_save(struct section_file *file, const struct city *pcity, const char *citystr)
Definition classicai.c:203
static void cai_unit_close(struct unit *punit)
Definition classicai.c:306
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_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
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
void dai_build_adv_init(struct ai_type *ait, struct player *pplayer)
Definition daicity.c:1929
void dai_gov_value(struct ai_type *ait, struct player *pplayer, struct government *gov, adv_want *val, bool *override)
Definition daidata.c:524
void dai_data_phase_begin(struct ai_type *ait, struct player *pplayer, bool is_new_phase)
Definition daidata.c:142
void dai_data_phase_finished(struct ai_type *ait, struct player *pplayer)
Definition daidata.c:285
void dai_treaty_accepted(struct ai_type *ait, struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
void dai_incident(struct ai_type *ait, enum incident_type type, enum casus_belli_range scope, const struct action *paction, struct player *receiver, struct player *violator, struct player *victim)
void dai_revolution_start(struct ai_type *ait, struct player *pplayer)
void dai_diplomacy_actions(struct ai_type *ait, struct player *pplayer)
void dai_treaty_evaluate(struct ai_type *ait, struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
void dai_diplomacy_first_contact(struct ai_type *ait, struct player *pplayer, struct player *aplayer)
void dai_wonder_city_distance(struct ai_type *ait, struct player *pplayer, struct adv_data *adv)
void dai_unit_log(struct ai_type *ait, char *buffer, int buflength, const struct unit *punit)
Definition dailog.c:54
void dai_city_log(struct ai_type *ait, char *buffer, int buflength, const struct city *pcity)
Definition dailog.c:41
void dai_assess_danger_player(struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer)
void dai_player_alloc(struct ai_type *ait, struct player *pplayer)
Definition daiplayer.c:38
void dai_player_copy(struct ai_type *ait, struct player *original, struct player *created)
Definition daiplayer.c:151
void dai_player_save_relations(struct ai_type *ait, const char *aitstr, struct player *pplayer, struct player *other, struct section_file *file, int plrno)
Definition daiplayer.c:77
void dai_player_free(struct ai_type *ait, struct player *pplayer)
Definition daiplayer.c:50
void dai_gained_control(struct ai_type *ait, struct player *pplayer)
Definition daiplayer.c:174
void dai_player_load_relations(struct ai_type *ait, const char *aitstr, struct player *pplayer, struct player *other, const struct section_file *file, int plrno)
Definition daiplayer.c:120
void dai_auto_settler_cont(struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer, struct unit *punit, struct settlermap *state)
void dai_auto_settler_reset(struct ai_type *ait, struct player *pplayer)
void dai_auto_settler_run(struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer, struct unit *punit, struct settlermap *state)
void dai_unit_save(struct ai_type *ait, const char *aitstr, struct section_file *file, const struct unit *punit, const char *unitstr)
Definition daiunit.c:3362
void dai_units_ruleset_init(struct ai_type *ait)
Definition daiunit.c:3201
void dai_switch_to_explore(struct ai_type *ait, struct unit *punit, struct tile *target, enum override_bool *allow)
Definition daiunit.c:3476
void dai_unit_turn_end(struct ai_type *ait, struct unit *punit)
Definition daiunit.c:3332
void dai_unit_init(struct ai_type *ait, struct unit *punit)
Definition daiunit.c:3310
void dai_consider_tile_dangerous(struct ai_type *ait, struct tile *ptile, struct unit *punit, enum override_bool *result)
Definition daiunit.c:3121
void dai_unit_load(struct ai_type *ait, const char *aitstr, const struct section_file *file, struct unit *punit, const char *unitstr)
Definition daiunit.c:3381
void dai_unit_close(struct ai_type *ait, struct unit *punit)
Definition daiunit.c:3344
void dai_units_ruleset_close(struct ai_type *ait)
Definition daiunit.c:3292
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:74
struct Treaty * ptreaty
Definition diplodlg_g.h:28
float adv_want
Definition fc_types.h:1354
adv_unit_task
Definition fc_types.h:370
override_bool
Definition fc_types.h:94
struct world wld
Definition game.c:63
GType type
Definition repodlgs.c:1313
#define FC_FREE(ptr)
Definition mem.h:41
#define fc_malloc(sz)
Definition mem.h:34
int step
Definition specpq.h:92
Definition ai.h:50
void(* revolution_start)(struct player *pplayer)
Definition ai.h:320
void(* log_fragment_unit)(char *buffer, int buflength, const struct unit *punit)
Definition ai.h:287
void(* city_alloc)(struct city *pcity)
Definition ai.h:128
void(* created_by_civil_war)(struct player *original, struct player *created)
Definition ai.h:117
void(* consider_tile_dangerous)(struct tile *ptile, struct unit *punit, enum override_bool *result)
Definition ai.h:294
void(* unit_lost)(struct unit *punit)
Definition ai.h:205
void(* treaty_evaluate)(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition ai.h:260
void(* gov_value)(struct player *pplayer, struct government *gov, adv_want *val, bool *override)
Definition ai.h:173
void(* treaty_accepted)(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition ai.h:265
void(* unit_transformed)(struct unit *punit, const struct unit_type *old_type)
Definition ai.h:202
void(* log_fragment_city)(char *buffer, int buflength, const struct city *pcity)
Definition ai.h:283
void(* settler_run)(struct player *pplayer, struct unit *punit, struct settlermap *state)
Definition ai.h:233
void(* unit_load)(const struct section_file *file, struct unit *punit, const char *unitstr)
Definition ai.h:226
void(* unit_move)(struct unit *punit, struct tile *ptile, struct pf_path *path, int step)
Definition ai.h:211
void(* unit_free)(struct unit *punit)
Definition ai.h:188
void(* phase_finished)(struct player *pplayer)
Definition ai.h:124
void(* restart_phase)(struct player *pplayer)
Definition ai.h:250
void(* settler_reset)(struct player *pplayer)
Definition ai.h:230
void(* unit_save)(struct section_file *file, const struct unit *punit, const char *unitstr)
Definition ai.h:222
void(* units_ruleset_close)(void)
Definition ai.h:180
void(* diplomacy_actions)(struct player *pplayer)
Definition ai.h:254
void(* player_alloc)(struct player *pplayer)
Definition ai.h:77
void(* build_adv_prepare)(struct player *pplayer, struct adv_data *adv)
Definition ai.h:161
void(* build_adv_adjust_want)(struct player *pplayer, struct city *wonder_city)
Definition ai.h:170
void(* build_adv_init)(struct player *pplayer)
Definition ai.h:165
void(* unit_task)(struct unit *punit, enum adv_unit_task task, struct tile *ptile)
Definition ai.h:218
void(* last_activities)(struct player *pplayer)
Definition ai.h:257
void(* incident)(enum incident_type type, enum casus_belli_range scope, const struct action *paction, struct player *receiver, struct player *violator, struct player *victim)
Definition ai.h:276
void(* settler_cont)(struct player *pplayer, struct unit *punit, struct settlermap *state)
Definition ai.h:238
void(* first_contact)(struct player *pplayer, struct player *aplayer)
Definition ai.h:272
void(* city_save)(struct section_file *file, const struct city *pcity, const char *citystr)
Definition ai.h:149
void(* consider_wonder_city)(struct city *pcity, bool *result)
Definition ai.h:299
void(* city_free)(struct city *pcity)
Definition ai.h:132
void(* choose_building)(struct city *pcity, struct adv_choice *choice)
Definition ai.h:158
struct ai_type::@14 funcs
void(* player_save_relations)(struct player *pplayer, struct player *other, struct section_file *file, int plrno)
Definition ai.h:96
void(* module_close)(void)
Definition ai.h:57
void(* city_load)(const struct section_file *file, struct city *pcity, const char *citystr)
Definition ai.h:153
void(* player_load_relations)(struct player *pplayer, struct player *other, const struct section_file *file, int plrno)
Definition ai.h:101
void(* phase_begin)(struct player *pplayer, bool new_phase)
Definition ai.h:121
void(* player_free)(struct player *pplayer)
Definition ai.h:80
void(* split_by_civil_war)(struct player *original, struct player *created)
Definition ai.h:114
void(* unit_turn_end)(struct unit *punit)
Definition ai.h:208
void(* unit_alloc)(struct unit *punit)
Definition ai.h:184
void(* gained_control)(struct player *pplayer)
Definition ai.h:108
char name[MAX_LEN_NAME]
Definition ai.h:51
void(* unit_got)(struct unit *punit)
Definition ai.h:199
void * private
Definition ai.h:53
void(* first_activities)(struct player *pplayer)
Definition ai.h:247
void(* consider_plr_dangerous)(struct player *plr1, struct player *plr2, enum override_bool *result)
Definition ai.h:290
void(* units_ruleset_init)(void)
Definition ai.h:177
void(* want_to_explore)(struct unit *punit, struct tile *target, enum override_bool *allow)
Definition ai.h:242
Definition city.h:320
bool ai_phase_done
Definition player.h:262
Definition tile.h:50
Definition unit.h:138
struct civ_map map
#define TRUE
Definition support.h:46