Freeciv-3.4
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 "map.h"
21#include "player.h"
22
23/* server/advisors */
24#include "advdata.h"
25
26/* ai/default */
27#include "daicity.h"
28#include "daidata.h"
29#include "daidiplomacy.h"
30#include "daidomestic.h"
31#include "daiferry.h"
32#include "daihand.h"
33#include "dailog.h"
34#include "daimilitary.h"
35#include "daiplayer.h"
36#include "daisanity.h"
37#include "daisettler.h"
38#include "daitools.h"
39#include "daiunit.h"
40
41#include "classicai.h"
42
43/* This function is only needed as symbol in module. Nevertheless
44 gcc requires that there is prior prototype. */
45const char *fc_ai_classic_capstr(void);
46
47static struct ai_type *self = NULL;
48
49/**********************************************************************/
52static void classic_ai_set_self(struct ai_type *ai)
53{
54 self = ai;
55}
56
57/**********************************************************************/
60static struct ai_type *classic_ai_get_self(void)
61{
62 return self;
63}
64
65/**********************************************************************/
68const char *fc_ai_classic_capstr(void)
69{
70 return FC_AI_MOD_CAPSTR;
71}
72
73/**********************************************************************/
76static void cai_module_close(void)
77{
78 struct ai_type *deftype = classic_ai_get_self();
79
80 FC_FREE(deftype->private);
81}
82
83/**********************************************************************/
86static void cai_player_alloc(struct player *pplayer)
87{
88 struct ai_type *deftype = classic_ai_get_self();
89
90 dai_player_alloc(deftype, pplayer);
91}
92
93/**********************************************************************/
96static void cai_player_free(struct player *pplayer)
97{
98 struct ai_type *deftype = classic_ai_get_self();
99
100 dai_player_free(deftype, pplayer);
101}
102
103/**********************************************************************/
107static void cai_player_save_relations(struct player *pplayer,
108 struct player *other,
109 struct section_file *file,
110 int plrno)
111{
112 struct ai_type *deftype = classic_ai_get_self();
113
114 dai_player_save_relations(deftype, "ai", pplayer, other, file, plrno);
115}
116
117/**********************************************************************/
120static void cai_player_load_relations(struct player *pplayer,
121 struct player *other,
122 const struct section_file *file,
123 int plrno)
124{
125 struct ai_type *deftype = classic_ai_get_self();
126
127 dai_player_load_relations(deftype, "ai", pplayer, other, file, plrno);
128}
129
130/**********************************************************************/
133static void cai_gained_control(struct player *pplayer)
134{
135 struct ai_type *deftype = classic_ai_get_self();
136
137 dai_gained_control(deftype, pplayer);
138}
139
140/**********************************************************************/
143static void cai_split_by_civil_war(struct player *original,
144 struct player *created)
145{
146 struct ai_type *deftype = classic_ai_get_self();
147
148 dai_assess_danger_player(deftype, &(wld.map), original);
149}
150
151/**********************************************************************/
154static void cai_created_by_civil_war(struct player *original,
155 struct player *created)
156{
157 struct ai_type *deftype = classic_ai_get_self();
158
159 dai_player_copy(deftype, original, created);
160}
161
162/**********************************************************************/
165static void cai_data_phase_begin(struct player *pplayer, bool is_new_phase)
166{
167 struct ai_type *deftype = classic_ai_get_self();
168
169 dai_data_phase_begin(deftype, pplayer, is_new_phase);
170}
171
172/**********************************************************************/
175static void cai_data_phase_finished(struct player *pplayer)
176{
177 struct ai_type *deftype = classic_ai_get_self();
178
179 dai_data_phase_finished(deftype, pplayer);
180}
181
182/**********************************************************************/
185static void cai_city_alloc(struct city *pcity)
186{
187 struct ai_type *deftype = classic_ai_get_self();
188
189 dai_city_alloc(deftype, pcity);
190}
191
192/**********************************************************************/
195static void cai_city_free(struct city *pcity)
196{
197 struct ai_type *deftype = classic_ai_get_self();
198
199 dai_city_free(deftype, pcity);
200}
201
202/**********************************************************************/
205static void cai_city_save(struct section_file *file, const struct city *pcity,
206 const char *citystr)
207{
208 struct ai_type *deftype = classic_ai_get_self();
209
210 dai_city_save(deftype, "ai", file, pcity, citystr);
211}
212
213/**********************************************************************/
216static void cai_city_load(const struct section_file *file, struct city *pcity,
217 const char *citystr)
218{
219 struct ai_type *deftype = classic_ai_get_self();
220
221 dai_city_load(deftype, "ai", file, pcity, citystr);
222}
223
224/**********************************************************************/
227static void cai_build_adv_override(struct city *pcity, struct adv_choice *choice)
228{
229 struct ai_type *deftype = classic_ai_get_self();
230
231 dai_build_adv_override(deftype, pcity, choice);
232}
233
234/**********************************************************************/
237static void cai_wonder_city_distance(struct player *pplayer, struct adv_data *adv)
238{
239 struct ai_type *deftype = classic_ai_get_self();
240
241 dai_wonder_city_distance(deftype, pplayer, adv);
242}
243
244/**********************************************************************/
247static void cai_build_adv_init(struct player *pplayer)
248{
249 struct ai_type *deftype = classic_ai_get_self();
250
251 dai_build_adv_init(deftype, pplayer);
252}
253
254/**********************************************************************/
257static void cai_build_adv_adjust(struct player *pplayer, struct city *wonder_city)
258{
259 struct ai_type *deftype = classic_ai_get_self();
260
261 dai_build_adv_adjust(deftype, pplayer, wonder_city);
262}
263
264/**********************************************************************/
267static void cai_gov_value(struct player *pplayer, struct government *gov,
268 adv_want *val, bool *override)
269{
270 struct ai_type *deftype = classic_ai_get_self();
271
272 dai_gov_value(deftype, pplayer, gov, val, override);
273}
274
275/**********************************************************************/
278static void cai_units_ruleset_init(void)
279{
280 struct ai_type *deftype = classic_ai_get_self();
281
282 dai_units_ruleset_init(deftype);
283}
284
285/**********************************************************************/
288static void cai_units_ruleset_close(void)
289{
290 struct ai_type *deftype = classic_ai_get_self();
291
293}
294
295/**********************************************************************/
298static void cai_unit_init(struct unit *punit)
299{
300 struct ai_type *deftype = classic_ai_get_self();
301
302 dai_unit_init(deftype, punit);
303}
304
305/**********************************************************************/
308static void cai_unit_close(struct unit *punit)
309{
310 struct ai_type *deftype = classic_ai_get_self();
311
312 dai_unit_close(deftype, punit);
313}
314
315/**********************************************************************/
318static void cai_ferry_init_ferry(struct unit *ferry)
319{
320 struct ai_type *deftype = classic_ai_get_self();
321
322 dai_ferry_init_ferry(deftype, ferry);
323}
324
325/**********************************************************************/
328static void cai_ferry_transformed(struct unit *ferry, const struct unit_type *old)
329{
330 struct ai_type *deftype = classic_ai_get_self();
331
332 dai_ferry_transformed(deftype, ferry, old);
333}
334
335/**********************************************************************/
338static void cai_ferry_lost(struct unit *punit)
339{
340 struct ai_type *deftype = classic_ai_get_self();
341
342 dai_ferry_lost(deftype, punit);
343}
344
345/**********************************************************************/
348static void cai_unit_turn_end(struct unit *punit)
349{
350 struct ai_type *deftype = classic_ai_get_self();
351
352 dai_unit_turn_end(deftype, punit);
353}
354
355/**********************************************************************/
358static void cai_unit_move_or_attack(struct unit *punit, struct tile *ptile,
359 struct pf_path *path, int step)
360{
361 struct ai_type *deftype = classic_ai_get_self();
362
363 dai_unit_move_or_attack(deftype, punit, ptile, path, step);
364}
365
366/**********************************************************************/
369static void cai_unit_new_adv_task(struct unit *punit, enum adv_unit_task task,
370 struct tile *ptile)
371{
372 struct ai_type *deftype = classic_ai_get_self();
373
374 dai_unit_new_adv_task(deftype, punit, task, ptile);
375}
376
377/**********************************************************************/
380static void cai_unit_save(struct section_file *file, const struct unit *punit,
381 const char *unitstr)
382{
383 struct ai_type *deftype = classic_ai_get_self();
384
385 dai_unit_save(deftype, "", file, punit, unitstr);
386}
387
388/**********************************************************************/
391static void cai_unit_load(const struct section_file *file, struct unit *punit,
392 const char *unitstr)
393{
394 struct ai_type *deftype = classic_ai_get_self();
395
396 dai_unit_load(deftype, "", file, punit, unitstr);
397}
398
399/**********************************************************************/
402static void cai_auto_settler_reset(struct player *pplayer)
403{
404 struct ai_type *deftype = classic_ai_get_self();
405
406 dai_auto_settler_reset(deftype, pplayer);
407}
408
409/**********************************************************************/
412static void cai_auto_settler_run(struct player *pplayer,
413 struct unit *punit,
414 struct workermap *state)
415{
416 struct ai_type *deftype = classic_ai_get_self();
417
418 dai_auto_settler_run(deftype, &(wld.map), pplayer, punit, state);
419}
420
421/**********************************************************************/
424static void cai_auto_settler_cont(struct player *pplayer,
425 struct unit *punit,
426 struct workermap *state)
427{
428 struct ai_type *deftype = classic_ai_get_self();
429
430 dai_auto_settler_cont(deftype, &(wld.map), pplayer, punit, state);
431}
432
433/**********************************************************************/
436static void cai_switch_to_explore(struct unit *punit, struct tile *target,
437 enum override_bool *allow)
438{
439 struct ai_type *deftype = classic_ai_get_self();
440
441 dai_switch_to_explore(deftype, punit, target, allow);
442}
443
444/**********************************************************************/
447static void cai_do_first_activities(struct player *pplayer)
448{
449 struct ai_type *deftype = classic_ai_get_self();
450
451 dai_do_first_activities(deftype, pplayer);
452
453 pplayer->ai_phase_done = TRUE;
454}
455
456/**********************************************************************/
459static void cai_restart_phase(struct player *pplayer)
460{
461 pplayer->ai_phase_done = TRUE;
462}
463
464/**********************************************************************/
467static void cai_diplomacy_actions(struct player *pplayer)
468{
469 struct ai_type *deftype = classic_ai_get_self();
470
471 dai_diplomacy_actions(deftype, pplayer);
472}
473
474/**********************************************************************/
477static void cai_do_last_activities(struct player *pplayer)
478{
479 struct ai_type *deftype = classic_ai_get_self();
480
481 dai_do_last_activities(deftype, pplayer);
482}
483
484/**********************************************************************/
487static void cai_treaty_evaluate(struct player *pplayer, struct player *aplayer,
488 struct treaty *ptreaty)
489{
490 struct ai_type *deftype = classic_ai_get_self();
491
492 dai_treaty_evaluate(deftype, pplayer, aplayer, ptreaty);
493}
494
495/**********************************************************************/
498static void cai_treaty_accepted(struct player *pplayer, struct player *aplayer,
499 struct treaty *ptreaty)
500{
501 struct ai_type *deftype = classic_ai_get_self();
502
503 dai_treaty_accepted(deftype, pplayer, aplayer, ptreaty);
504}
505
506/**********************************************************************/
509static void cai_diplomacy_first_contact(struct player *pplayer,
510 struct player *aplayer)
511{
512 struct ai_type *deftype = classic_ai_get_self();
513
514 dai_diplomacy_first_contact(deftype, pplayer, aplayer);
515}
516
517/**********************************************************************/
521 enum casus_belli_range scope,
522 const struct action *paction,
523 struct player *receiver,
524 struct player *violator, struct player *victim)
525{
526 struct ai_type *deftype = classic_ai_get_self();
527
528 dai_incident(deftype, type, scope, paction, receiver, violator, victim);
529}
530
531/**********************************************************************/
534static void cai_city_log(char *buffer, int buflength, const struct city *pcity)
535{
536 struct ai_type *deftype = classic_ai_get_self();
537
538 dai_city_log(deftype, buffer, buflength, pcity);
539}
540
541/**********************************************************************/
544static void cai_unit_log(char *buffer, int buflength, const struct unit *punit)
545{
546 struct ai_type *deftype = classic_ai_get_self();
547
548 dai_unit_log(deftype, buffer, buflength, punit);
549}
550
551/**********************************************************************/
554static void cai_consider_plr_dangerous(struct player *plr1, struct player *plr2,
555 enum override_bool *result)
556{
557 struct ai_type *deftype = classic_ai_get_self();
558
559 dai_consider_plr_dangerous(deftype, plr1, plr2, result);
560}
561
562/**********************************************************************/
565static void cai_consider_tile_dangerous(struct tile *ptile, struct unit *punit,
566 enum override_bool *result)
567{
568 struct ai_type *deftype = classic_ai_get_self();
569
570 dai_consider_tile_dangerous(deftype, ptile, punit, result);
571}
572
573/**********************************************************************/
576static void cai_consider_wonder_city(struct city *pcity, bool *result)
577{
578 struct ai_type *deftype = classic_ai_get_self();
579
580 dai_consider_wonder_city(deftype, pcity, result);
581}
582
583/**********************************************************************/
586static void cai_revolution_start(struct player *pplayer)
587{
588 struct ai_type *deftype = classic_ai_get_self();
589
590 dai_revolution_start(deftype, pplayer);
591}
592
593/**********************************************************************/
596static void cai_sanity_check(struct player *pplayer)
597{
598 struct ai_type *deftype = classic_ai_get_self();
599
600 dai_sanity_check(deftype, pplayer);
601}
602
603/**********************************************************************/
607{
608 struct dai_private_data *private;
609
611
612 strncpy(ai->name, "classic", sizeof(ai->name));
613
614 private = fc_malloc(sizeof(struct dai_private_data));
615 private->contemplace_workers = TRUE;
616 ai->private = private;
617
619
620 /* ai->funcs.map_alloc = NULL; */
621 /* ai->funcs.map_ready = NULL; */
622 /* ai->funcs.map_free = NULL; */
623 /* ai->funcs.game_start = NULL; */
624 /* ai->funcs.game_free = NULL; */
625
628 /* ai->funcs.player_save = NULL; */
629 /* ai->funcs.player_load = NULL; */
633 /* ai->funcs.lost_control = NULL; */
636
639
642 /*
643 ai->funcs.city_created = NULL;
644 ai->funcs.city_destroyed = NULL;
645 ai->funcs.city_got = NULL;
646 ai->funcs.city_lost = NULL;
647 */
654
656
659
660 /* FIXME: We should allocate memory only for units owned by
661 default ai in unit_got. We track no data
662 about enemy units.
663 But advisors code still depends on some default ai data (role) to be
664 always allocated. */
665 /*
666 ai->funcs.unit_alloc = NULL;
667 ai->funcs.unit_free = NULL;
668 ai->funcs.unit_created = NULL;
669 ai->funcs.unit_destroyed = NULL;
670 ai->funcs.unit_got = dai_unit_init;
671 ai->funcs.unit_lost = dai_unit_close;
672 */
678
681 /* ai->funcs.unit_move_seen = NULL; */
683
686
690
692
701
704
708
709 /* ai->funcs.refresh = NULL; */
710
711 /* ai->funcs.tile_info = NULL; */
712 /* ai->funcs.city_info = NULL; */
713 /* ai->funcs.unit_info = NULL; */
714
717
718 return TRUE;
719}
#define FC_AI_MOD_CAPSTR
Definition ai.h:27
incident_type
Definition ai.h:45
static void cai_restart_phase(struct player *pplayer)
Definition classicai.c:459
static void cai_city_log(char *buffer, int buflength, const struct city *pcity)
Definition classicai.c:534
static void cai_ferry_lost(struct unit *punit)
Definition classicai.c:338
static void cai_city_free(struct city *pcity)
Definition classicai.c:195
static void cai_player_load_relations(struct player *pplayer, struct player *other, const struct section_file *file, int plrno)
Definition classicai.c:120
static void cai_module_close(void)
Definition classicai.c:76
const char * fc_ai_classic_capstr(void)
Definition classicai.c:68
static void cai_treaty_evaluate(struct player *pplayer, struct player *aplayer, struct treaty *ptreaty)
Definition classicai.c:487
static void cai_units_ruleset_init(void)
Definition classicai.c:278
static void cai_city_alloc(struct city *pcity)
Definition classicai.c:185
static void cai_wonder_city_distance(struct player *pplayer, struct adv_data *adv)
Definition classicai.c:237
static void cai_build_adv_adjust(struct player *pplayer, struct city *wonder_city)
Definition classicai.c:257
static struct ai_type * classic_ai_get_self(void)
Definition classicai.c:60
static void cai_diplomacy_first_contact(struct player *pplayer, struct player *aplayer)
Definition classicai.c:509
static void cai_units_ruleset_close(void)
Definition classicai.c:288
static void cai_unit_save(struct section_file *file, const struct unit *punit, const char *unitstr)
Definition classicai.c:380
static void cai_do_last_activities(struct player *pplayer)
Definition classicai.c:477
static void cai_unit_turn_end(struct unit *punit)
Definition classicai.c:348
static void cai_player_alloc(struct player *pplayer)
Definition classicai.c:86
static void cai_created_by_civil_war(struct player *original, struct player *created)
Definition classicai.c:154
static void cai_switch_to_explore(struct unit *punit, struct tile *target, enum override_bool *allow)
Definition classicai.c:436
static void cai_sanity_check(struct player *pplayer)
Definition classicai.c:596
static void cai_gov_value(struct player *pplayer, struct government *gov, adv_want *val, bool *override)
Definition classicai.c:267
bool fc_ai_classic_setup(struct ai_type *ai)
Definition classicai.c:606
static void cai_data_phase_finished(struct player *pplayer)
Definition classicai.c:175
static void cai_ferry_init_ferry(struct unit *ferry)
Definition classicai.c:318
static void cai_unit_init(struct unit *punit)
Definition classicai.c:298
static void cai_diplomacy_actions(struct player *pplayer)
Definition classicai.c:467
static void cai_build_adv_init(struct player *pplayer)
Definition classicai.c:247
static void cai_data_phase_begin(struct player *pplayer, bool is_new_phase)
Definition classicai.c:165
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:520
static void cai_consider_tile_dangerous(struct tile *ptile, struct unit *punit, enum override_bool *result)
Definition classicai.c:565
static void cai_unit_move_or_attack(struct unit *punit, struct tile *ptile, struct pf_path *path, int step)
Definition classicai.c:358
static void cai_do_first_activities(struct player *pplayer)
Definition classicai.c:447
static void cai_gained_control(struct player *pplayer)
Definition classicai.c:133
static void cai_revolution_start(struct player *pplayer)
Definition classicai.c:586
static void cai_build_adv_override(struct city *pcity, struct adv_choice *choice)
Definition classicai.c:227
static void cai_city_load(const struct section_file *file, struct city *pcity, const char *citystr)
Definition classicai.c:216
static void cai_unit_log(char *buffer, int buflength, const struct unit *punit)
Definition classicai.c:544
static void cai_ferry_transformed(struct unit *ferry, const struct unit_type *old)
Definition classicai.c:328
static void cai_consider_wonder_city(struct city *pcity, bool *result)
Definition classicai.c:576
static struct ai_type * self
Definition classicai.c:47
static void cai_unit_load(const struct section_file *file, struct unit *punit, const char *unitstr)
Definition classicai.c:391
static void classic_ai_set_self(struct ai_type *ai)
Definition classicai.c:52
static void cai_auto_settler_cont(struct player *pplayer, struct unit *punit, struct workermap *state)
Definition classicai.c:424
static void cai_player_free(struct player *pplayer)
Definition classicai.c:96
static void cai_player_save_relations(struct player *pplayer, struct player *other, struct section_file *file, int plrno)
Definition classicai.c:107
static void cai_auto_settler_run(struct player *pplayer, struct unit *punit, struct workermap *state)
Definition classicai.c:412
static void cai_consider_plr_dangerous(struct player *plr1, struct player *plr2, enum override_bool *result)
Definition classicai.c:554
static void cai_unit_new_adv_task(struct unit *punit, enum adv_unit_task task, struct tile *ptile)
Definition classicai.c:369
static void cai_treaty_accepted(struct player *pplayer, struct player *aplayer, struct treaty *ptreaty)
Definition classicai.c:498
static void cai_auto_settler_reset(struct player *pplayer)
Definition classicai.c:402
static void cai_split_by_civil_war(struct player *original, struct player *created)
Definition classicai.c:143
static void cai_city_save(struct section_file *file, const struct city *pcity, const char *citystr)
Definition classicai.c:205
static void cai_unit_close(struct unit *punit)
Definition classicai.c:308
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:1162
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:1190
void dai_city_alloc(struct ai_type *ait, struct city *pcity)
Definition daicity.c:1135
void dai_consider_wonder_city(struct ai_type *ait, struct city *pcity, bool *result)
Definition daicity.c:2095
void dai_build_adv_adjust(struct ai_type *ait, struct player *pplayer, struct city *wonder_city)
Definition daicity.c:1983
void dai_city_free(struct ai_type *ait, struct city *pcity)
Definition daicity.c:1148
void dai_build_adv_init(struct ai_type *ait, struct player *pplayer)
Definition daicity.c:1966
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_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_accepted(struct ai_type *ait, struct player *pplayer, struct player *aplayer, struct treaty *ptreaty)
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_ferry_lost(struct ai_type *ait, struct unit *punit)
Definition daiferry.c:221
void dai_ferry_transformed(struct ai_type *ait, struct unit *ferry, const struct unit_type *old)
Definition daiferry.c:189
void dai_ferry_init_ferry(struct ai_type *ait, struct unit *ferry)
Definition daiferry.c:167
void dai_do_last_activities(struct ai_type *ait, struct player *pplayer)
Definition daihand.c:774
void dai_do_first_activities(struct ai_type *ait, struct player *pplayer)
Definition daihand.c:748
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_sanity_check(struct ai_type *ait, struct player *pplayer)
Definition daisanity.c:30
void dai_auto_settler_run(struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer, struct unit *punit, struct workermap *state)
void dai_auto_settler_cont(struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer, struct unit *punit, struct workermap *state)
void dai_auto_settler_reset(struct ai_type *ait, struct player *pplayer)
void dai_build_adv_override(struct ai_type *ait, struct city *pcity, struct adv_choice *choice)
Definition daitools.c:1396
void dai_consider_plr_dangerous(struct ai_type *ait, struct player *plr1, struct player *plr2, enum override_bool *result)
Definition daitools.c:141
void dai_unit_new_adv_task(struct ai_type *ait, struct unit *punit, enum adv_unit_task task, struct tile *ptile)
Definition daitools.c:619
void dai_unit_move_or_attack(struct ai_type *ait, struct unit *punit, struct tile *ptile, struct pf_path *path, int step)
Definition daitools.c:1093
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:3428
void dai_units_ruleset_init(struct ai_type *ait)
Definition daiunit.c:3267
void dai_switch_to_explore(struct ai_type *ait, struct unit *punit, struct tile *target, enum override_bool *allow)
Definition daiunit.c:3543
void dai_unit_turn_end(struct ai_type *ait, struct unit *punit)
Definition daiunit.c:3398
void dai_unit_init(struct ai_type *ait, struct unit *punit)
Definition daiunit.c:3376
void dai_consider_tile_dangerous(struct ai_type *ait, struct tile *ptile, struct unit *punit, enum override_bool *result)
Definition daiunit.c:3186
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:3447
void dai_unit_close(struct ai_type *ait, struct unit *punit)
Definition daiunit.c:3410
void dai_units_ruleset_close(struct ai_type *ait)
Definition daiunit.c:3358
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 unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:78
struct treaty * ptreaty
Definition diplodlg_g.h:28
float adv_want
Definition fc_types.h:1050
adv_unit_task
Definition fc_types.h:231
override_bool
Definition fc_types.h:96
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(* gov_value)(struct player *pplayer, struct government *gov, adv_want *val, bool *override)
Definition ai.h:173
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 workermap *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(* treaty_evaluate)(struct player *pplayer, struct player *aplayer, struct treaty *ptreaty)
Definition ai.h:260
void(* check_sanity)(struct player *pplayer)
Definition ai.h:323
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(* 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
struct ai_type::@15 funcs
void(* city_free)(struct city *pcity)
Definition ai.h:132
void(* choose_building)(struct city *pcity, struct adv_choice *choice)
Definition ai.h:158
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(* treaty_accepted)(struct player *pplayer, struct player *aplayer, struct treaty *ptreaty)
Definition ai.h:265
void(* units_ruleset_init)(void)
Definition ai.h:177
void(* settler_cont)(struct player *pplayer, struct unit *punit, struct workermap *state)
Definition ai.h:238
void(* want_to_explore)(struct unit *punit, struct tile *target, enum override_bool *allow)
Definition ai.h:242
Definition city.h:318
bool ai_phase_done
Definition player.h:264
Definition tile.h:50
Definition unit.h:140
struct civ_map map
#define TRUE
Definition support.h:46