Freeciv-3.3
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 "aiferry.h"
28#include "aihand.h"
29#include "daicity.h"
30#include "daidata.h"
31#include "daidiplomacy.h"
32#include "daidomestic.h"
33#include "dailog.h"
34#include "daimilitary.h"
35#include "daiplayer.h"
36#include "daisettler.h"
37#include "daitools.h"
38#include "daiunit.h"
39
40#include "classicai.h"
41
42/* This function is only needed as symbol in module. Nevertheless
43 gcc requires that there is prior prototype. */
44const char *fc_ai_classic_capstr(void);
45
46static struct ai_type *self = NULL;
47
48/**********************************************************************/
51static void classic_ai_set_self(struct ai_type *ai)
52{
53 self = ai;
54}
55
56/**********************************************************************/
59static struct ai_type *classic_ai_get_self(void)
60{
61 return self;
62}
63
64/**********************************************************************/
67const char *fc_ai_classic_capstr(void)
68{
69 return FC_AI_MOD_CAPSTR;
70}
71
72/**********************************************************************/
75static void cai_module_close(void)
76{
77 struct ai_type *deftype = classic_ai_get_self();
78
79 FC_FREE(deftype->private);
80}
81
82/**********************************************************************/
85static void cai_player_alloc(struct player *pplayer)
86{
87 struct ai_type *deftype = classic_ai_get_self();
88
89 dai_player_alloc(deftype, pplayer);
90}
91
92/**********************************************************************/
95static void cai_player_free(struct player *pplayer)
96{
97 struct ai_type *deftype = classic_ai_get_self();
98
99 dai_player_free(deftype, pplayer);
100}
101
102/**********************************************************************/
106static void cai_player_save_relations(struct player *pplayer,
107 struct player *other,
108 struct section_file *file,
109 int plrno)
110{
111 struct ai_type *deftype = classic_ai_get_self();
112
113 dai_player_save_relations(deftype, "ai", pplayer, other, file, plrno);
114}
115
116/**********************************************************************/
119static void cai_player_load_relations(struct player *pplayer,
120 struct player *other,
121 const struct section_file *file,
122 int plrno)
123{
124 struct ai_type *deftype = classic_ai_get_self();
125
126 dai_player_load_relations(deftype, "ai", pplayer, other, file, plrno);
127}
128
129/**********************************************************************/
132static void cai_gained_control(struct player *pplayer)
133{
134 struct ai_type *deftype = classic_ai_get_self();
135
136 dai_gained_control(deftype, pplayer);
137}
138
139/**********************************************************************/
142static void cai_split_by_civil_war(struct player *original,
143 struct player *created)
144{
145 struct ai_type *deftype = classic_ai_get_self();
146
147 dai_assess_danger_player(deftype, &(wld.map), original);
148}
149
150/**********************************************************************/
153static void cai_created_by_civil_war(struct player *original,
154 struct player *created)
155{
156 struct ai_type *deftype = classic_ai_get_self();
157
158 dai_player_copy(deftype, original, created);
159}
160
161/**********************************************************************/
164static void cai_data_phase_begin(struct player *pplayer, bool is_new_phase)
165{
166 struct ai_type *deftype = classic_ai_get_self();
167
168 dai_data_phase_begin(deftype, pplayer, is_new_phase);
169}
170
171/**********************************************************************/
174static void cai_data_phase_finished(struct player *pplayer)
175{
176 struct ai_type *deftype = classic_ai_get_self();
177
178 dai_data_phase_finished(deftype, pplayer);
179}
180
181/**********************************************************************/
184static void cai_city_alloc(struct city *pcity)
185{
186 struct ai_type *deftype = classic_ai_get_self();
187
188 dai_city_alloc(deftype, pcity);
189}
190
191/**********************************************************************/
194static void cai_city_free(struct city *pcity)
195{
196 struct ai_type *deftype = classic_ai_get_self();
197
198 dai_city_free(deftype, pcity);
199}
200
201/**********************************************************************/
204static void cai_city_save(struct section_file *file, const struct city *pcity,
205 const char *citystr)
206{
207 struct ai_type *deftype = classic_ai_get_self();
208
209 dai_city_save(deftype, "ai", file, pcity, citystr);
210}
211
212/**********************************************************************/
215static void cai_city_load(const struct section_file *file, struct city *pcity,
216 const char *citystr)
217{
218 struct ai_type *deftype = classic_ai_get_self();
219
220 dai_city_load(deftype, "ai", file, pcity, citystr);
221}
222
223/**********************************************************************/
226static void cai_build_adv_override(struct city *pcity, struct adv_choice *choice)
227{
228 struct ai_type *deftype = classic_ai_get_self();
229
230 dai_build_adv_override(deftype, pcity, choice);
231}
232
233/**********************************************************************/
236static void cai_wonder_city_distance(struct player *pplayer, struct adv_data *adv)
237{
238 struct ai_type *deftype = classic_ai_get_self();
239
240 dai_wonder_city_distance(deftype, pplayer, adv);
241}
242
243/**********************************************************************/
246static void cai_build_adv_init(struct player *pplayer)
247{
248 struct ai_type *deftype = classic_ai_get_self();
249
250 dai_build_adv_init(deftype, pplayer);
251}
252
253/**********************************************************************/
256static void cai_build_adv_adjust(struct player *pplayer, struct city *wonder_city)
257{
258 struct ai_type *deftype = classic_ai_get_self();
259
260 dai_build_adv_adjust(deftype, pplayer, wonder_city);
261}
262
263/**********************************************************************/
266static void cai_gov_value(struct player *pplayer, struct government *gov,
267 adv_want *val, bool *override)
268{
269 struct ai_type *deftype = classic_ai_get_self();
270
271 dai_gov_value(deftype, pplayer, gov, val, override);
272}
273
274/**********************************************************************/
277static void cai_units_ruleset_init(void)
278{
279 struct ai_type *deftype = classic_ai_get_self();
280
281 dai_units_ruleset_init(deftype);
282}
283
284/**********************************************************************/
287static void cai_units_ruleset_close(void)
288{
289 struct ai_type *deftype = classic_ai_get_self();
290
292}
293
294/**********************************************************************/
297static void cai_unit_init(struct unit *punit)
298{
299 struct ai_type *deftype = classic_ai_get_self();
300
301 dai_unit_init(deftype, punit);
302}
303
304/**********************************************************************/
307static void cai_unit_close(struct unit *punit)
308{
309 struct ai_type *deftype = classic_ai_get_self();
310
311 dai_unit_close(deftype, punit);
312}
313
314/**********************************************************************/
317static void cai_ferry_init_ferry(struct unit *ferry)
318{
319 struct ai_type *deftype = classic_ai_get_self();
320
321 dai_ferry_init_ferry(deftype, ferry);
322}
323
324/**********************************************************************/
327static void cai_ferry_transformed(struct unit *ferry, const struct unit_type *old)
328{
329 struct ai_type *deftype = classic_ai_get_self();
330
331 dai_ferry_transformed(deftype, ferry, old);
332}
333
334/**********************************************************************/
337static void cai_ferry_lost(struct unit *punit)
338{
339 struct ai_type *deftype = classic_ai_get_self();
340
341 dai_ferry_lost(deftype, punit);
342}
343
344/**********************************************************************/
347static void cai_unit_turn_end(struct unit *punit)
348{
349 struct ai_type *deftype = classic_ai_get_self();
350
351 dai_unit_turn_end(deftype, punit);
352}
353
354/**********************************************************************/
357static void cai_unit_move_or_attack(struct unit *punit, struct tile *ptile,
358 struct pf_path *path, int step)
359{
360 struct ai_type *deftype = classic_ai_get_self();
361
362 dai_unit_move_or_attack(deftype, punit, ptile, path, step);
363}
364
365/**********************************************************************/
368static void cai_unit_new_adv_task(struct unit *punit, enum adv_unit_task task,
369 struct tile *ptile)
370{
371 struct ai_type *deftype = classic_ai_get_self();
372
373 dai_unit_new_adv_task(deftype, punit, task, ptile);
374}
375
376/**********************************************************************/
379static void cai_unit_save(struct section_file *file, const struct unit *punit,
380 const char *unitstr)
381{
382 struct ai_type *deftype = classic_ai_get_self();
383
384 dai_unit_save(deftype, "", file, punit, unitstr);
385}
386
387/**********************************************************************/
390static void cai_unit_load(const struct section_file *file, struct unit *punit,
391 const char *unitstr)
392{
393 struct ai_type *deftype = classic_ai_get_self();
394
395 dai_unit_load(deftype, "", file, punit, unitstr);
396}
397
398/**********************************************************************/
401static void cai_auto_settler_reset(struct player *pplayer)
402{
403 struct ai_type *deftype = classic_ai_get_self();
404
405 dai_auto_settler_reset(deftype, pplayer);
406}
407
408/**********************************************************************/
411static void cai_auto_settler_run(struct player *pplayer,
412 struct unit *punit,
413 struct workermap *state)
414{
415 struct ai_type *deftype = classic_ai_get_self();
416
417 dai_auto_settler_run(deftype, &(wld.map), pplayer, punit, state);
418}
419
420/**********************************************************************/
423static void cai_auto_settler_cont(struct player *pplayer,
424 struct unit *punit,
425 struct workermap *state)
426{
427 struct ai_type *deftype = classic_ai_get_self();
428
429 dai_auto_settler_cont(deftype, &(wld.map), pplayer, punit, state);
430}
431
432/**********************************************************************/
435static void cai_switch_to_explore(struct unit *punit, struct tile *target,
436 enum override_bool *allow)
437{
438 struct ai_type *deftype = classic_ai_get_self();
439
440 dai_switch_to_explore(deftype, punit, target, allow);
441}
442
443/**********************************************************************/
446static void cai_do_first_activities(struct player *pplayer)
447{
448 struct ai_type *deftype = classic_ai_get_self();
449
450 dai_do_first_activities(deftype, pplayer);
451
452 pplayer->ai_phase_done = TRUE;
453}
454
455/**********************************************************************/
458static void cai_restart_phase(struct player *pplayer)
459{
460 pplayer->ai_phase_done = TRUE;
461}
462
463/**********************************************************************/
466static void cai_diplomacy_actions(struct player *pplayer)
467{
468 struct ai_type *deftype = classic_ai_get_self();
469
470 dai_diplomacy_actions(deftype, pplayer);
471}
472
473/**********************************************************************/
476static void cai_do_last_activities(struct player *pplayer)
477{
478 struct ai_type *deftype = classic_ai_get_self();
479
480 dai_do_last_activities(deftype, pplayer);
481}
482
483/**********************************************************************/
486static void cai_treaty_evaluate(struct player *pplayer, struct player *aplayer,
487 struct treaty *ptreaty)
488{
489 struct ai_type *deftype = classic_ai_get_self();
490
491 dai_treaty_evaluate(deftype, pplayer, aplayer, ptreaty);
492}
493
494/**********************************************************************/
497static void cai_treaty_accepted(struct player *pplayer, struct player *aplayer,
498 struct treaty *ptreaty)
499{
500 struct ai_type *deftype = classic_ai_get_self();
501
502 dai_treaty_accepted(deftype, pplayer, aplayer, ptreaty);
503}
504
505/**********************************************************************/
508static void cai_diplomacy_first_contact(struct player *pplayer,
509 struct player *aplayer)
510{
511 struct ai_type *deftype = classic_ai_get_self();
512
513 dai_diplomacy_first_contact(deftype, pplayer, aplayer);
514}
515
516/**********************************************************************/
520 enum casus_belli_range scope,
521 const struct action *paction,
522 struct player *receiver,
523 struct player *violator, struct player *victim)
524{
525 struct ai_type *deftype = classic_ai_get_self();
526
527 dai_incident(deftype, type, scope, paction, receiver, violator, victim);
528}
529
530/**********************************************************************/
533static void cai_city_log(char *buffer, int buflength, const struct city *pcity)
534{
535 struct ai_type *deftype = classic_ai_get_self();
536
537 dai_city_log(deftype, buffer, buflength, pcity);
538}
539
540/**********************************************************************/
543static void cai_unit_log(char *buffer, int buflength, const struct unit *punit)
544{
545 struct ai_type *deftype = classic_ai_get_self();
546
547 dai_unit_log(deftype, buffer, buflength, punit);
548}
549
550/**********************************************************************/
553static void cai_consider_plr_dangerous(struct player *plr1, struct player *plr2,
554 enum override_bool *result)
555{
556 struct ai_type *deftype = classic_ai_get_self();
557
558 dai_consider_plr_dangerous(deftype, plr1, plr2, result);
559}
560
561/**********************************************************************/
564static void cai_consider_tile_dangerous(struct tile *ptile, struct unit *punit,
565 enum override_bool *result)
566{
567 struct ai_type *deftype = classic_ai_get_self();
568
569 dai_consider_tile_dangerous(deftype, ptile, punit, result);
570}
571
572/**********************************************************************/
575static void cai_consider_wonder_city(struct city *pcity, bool *result)
576{
577 struct ai_type *deftype = classic_ai_get_self();
578
579 dai_consider_wonder_city(deftype, pcity, result);
580}
581
582/**********************************************************************/
585static void cai_revolution_start(struct player *pplayer)
586{
587 struct ai_type *deftype = classic_ai_get_self();
588
589 dai_revolution_start(deftype, pplayer);
590}
591
592/**********************************************************************/
596{
597 struct dai_private_data *private;
598
600
601 strncpy(ai->name, "classic", sizeof(ai->name));
602
603 private = fc_malloc(sizeof(struct dai_private_data));
604 private->contemplace_workers = TRUE;
605 ai->private = private;
606
608
609 /* ai->funcs.map_alloc = NULL; */
610 /* ai->funcs.map_ready = NULL; */
611 /* ai->funcs.map_free = NULL; */
612 /* ai->funcs.game_start = NULL; */
613 /* ai->funcs.game_free = NULL; */
614
617 /* ai->funcs.player_save = NULL; */
618 /* ai->funcs.player_load = NULL; */
622 /* ai->funcs.lost_control = NULL; */
625
628
631 /*
632 ai->funcs.city_created = NULL;
633 ai->funcs.city_destroyed = NULL;
634 ai->funcs.city_got = NULL;
635 ai->funcs.city_lost = NULL;
636 */
643
645
648
649 /* FIXME: We should allocate memory only for units owned by
650 default ai in unit_got. We track no data
651 about enemy units.
652 But advisors code still depends on some default ai data (role) to be
653 always allocated. */
654 /*
655 ai->funcs.unit_alloc = NULL;
656 ai->funcs.unit_free = NULL;
657 ai->funcs.unit_created = NULL;
658 ai->funcs.unit_destroyed = NULL;
659 ai->funcs.unit_got = dai_unit_init;
660 ai->funcs.unit_lost = dai_unit_close;
661 */
667
670 /* ai->funcs.unit_move_seen = NULL; */
672
675
679
681
690
693
697
698 /* ai->funcs.refresh = NULL; */
699
700 /* ai->funcs.tile_info = NULL; */
701 /* ai->funcs.city_info = NULL; */
702 /* ai->funcs.unit_info = NULL; */
703
705
706 return TRUE;
707}
#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
static void cai_restart_phase(struct player *pplayer)
Definition classicai.c:458
static void cai_city_log(char *buffer, int buflength, const struct city *pcity)
Definition classicai.c:533
static void cai_ferry_lost(struct unit *punit)
Definition classicai.c:337
static void cai_city_free(struct city *pcity)
Definition classicai.c:194
static void cai_player_load_relations(struct player *pplayer, struct player *other, const struct section_file *file, int plrno)
Definition classicai.c:119
static void cai_module_close(void)
Definition classicai.c:75
const char * fc_ai_classic_capstr(void)
Definition classicai.c:67
static void cai_treaty_evaluate(struct player *pplayer, struct player *aplayer, struct treaty *ptreaty)
Definition classicai.c:486
static void cai_units_ruleset_init(void)
Definition classicai.c:277
static void cai_city_alloc(struct city *pcity)
Definition classicai.c:184
static void cai_wonder_city_distance(struct player *pplayer, struct adv_data *adv)
Definition classicai.c:236
static void cai_build_adv_adjust(struct player *pplayer, struct city *wonder_city)
Definition classicai.c:256
static struct ai_type * classic_ai_get_self(void)
Definition classicai.c:59
static void cai_diplomacy_first_contact(struct player *pplayer, struct player *aplayer)
Definition classicai.c:508
static void cai_units_ruleset_close(void)
Definition classicai.c:287
static void cai_unit_save(struct section_file *file, const struct unit *punit, const char *unitstr)
Definition classicai.c:379
static void cai_do_last_activities(struct player *pplayer)
Definition classicai.c:476
static void cai_unit_turn_end(struct unit *punit)
Definition classicai.c:347
static void cai_player_alloc(struct player *pplayer)
Definition classicai.c:85
static void cai_created_by_civil_war(struct player *original, struct player *created)
Definition classicai.c:153
static void cai_switch_to_explore(struct unit *punit, struct tile *target, enum override_bool *allow)
Definition classicai.c:435
static void cai_gov_value(struct player *pplayer, struct government *gov, adv_want *val, bool *override)
Definition classicai.c:266
bool fc_ai_classic_setup(struct ai_type *ai)
Definition classicai.c:595
static void cai_data_phase_finished(struct player *pplayer)
Definition classicai.c:174
static void cai_ferry_init_ferry(struct unit *ferry)
Definition classicai.c:317
static void cai_unit_init(struct unit *punit)
Definition classicai.c:297
static void cai_diplomacy_actions(struct player *pplayer)
Definition classicai.c:466
static void cai_build_adv_init(struct player *pplayer)
Definition classicai.c:246
static void cai_data_phase_begin(struct player *pplayer, bool is_new_phase)
Definition classicai.c:164
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:519
static void cai_consider_tile_dangerous(struct tile *ptile, struct unit *punit, enum override_bool *result)
Definition classicai.c:564
static void cai_unit_move_or_attack(struct unit *punit, struct tile *ptile, struct pf_path *path, int step)
Definition classicai.c:357
static void cai_do_first_activities(struct player *pplayer)
Definition classicai.c:446
static void cai_gained_control(struct player *pplayer)
Definition classicai.c:132
static void cai_revolution_start(struct player *pplayer)
Definition classicai.c:585
static void cai_build_adv_override(struct city *pcity, struct adv_choice *choice)
Definition classicai.c:226
static void cai_city_load(const struct section_file *file, struct city *pcity, const char *citystr)
Definition classicai.c:215
static void cai_unit_log(char *buffer, int buflength, const struct unit *punit)
Definition classicai.c:543
static void cai_ferry_transformed(struct unit *ferry, const struct unit_type *old)
Definition classicai.c:327
static void cai_consider_wonder_city(struct city *pcity, bool *result)
Definition classicai.c:575
static struct ai_type * self
Definition classicai.c:46
static void cai_unit_load(const struct section_file *file, struct unit *punit, const char *unitstr)
Definition classicai.c:390
static void classic_ai_set_self(struct ai_type *ai)
Definition classicai.c:51
static void cai_auto_settler_cont(struct player *pplayer, struct unit *punit, struct workermap *state)
Definition classicai.c:423
static void cai_player_free(struct player *pplayer)
Definition classicai.c:95
static void cai_player_save_relations(struct player *pplayer, struct player *other, struct section_file *file, int plrno)
Definition classicai.c:106
static void cai_auto_settler_run(struct player *pplayer, struct unit *punit, struct workermap *state)
Definition classicai.c:411
static void cai_consider_plr_dangerous(struct player *plr1, struct player *plr2, enum override_bool *result)
Definition classicai.c:553
static void cai_unit_new_adv_task(struct unit *punit, enum adv_unit_task task, struct tile *ptile)
Definition classicai.c:368
static void cai_treaty_accepted(struct player *pplayer, struct player *aplayer, struct treaty *ptreaty)
Definition classicai.c:497
static void cai_auto_settler_reset(struct player *pplayer)
Definition classicai.c:401
static void cai_split_by_civil_war(struct player *original, struct player *created)
Definition classicai.c:142
static void cai_city_save(struct section_file *file, const struct city *pcity, const char *citystr)
Definition classicai.c:204
static void cai_unit_close(struct unit *punit)
Definition classicai.c:307
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:1139
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:1166
void dai_city_alloc(struct ai_type *ait, struct city *pcity)
Definition daicity.c:1112
void dai_consider_wonder_city(struct ai_type *ait, struct city *pcity, bool *result)
Definition daicity.c:2060
void dai_build_adv_adjust(struct ai_type *ait, struct player *pplayer, struct city *wonder_city)
Definition daicity.c:1949
void dai_city_free(struct ai_type *ait, struct city *pcity)
Definition daicity.c:1125
void dai_build_adv_init(struct ai_type *ait, struct player *pplayer)
Definition daicity.c:1933
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_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_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:1368
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:1066
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:3369
void dai_units_ruleset_init(struct ai_type *ait)
Definition daiunit.c:3208
void dai_switch_to_explore(struct ai_type *ait, struct unit *punit, struct tile *target, enum override_bool *allow)
Definition daiunit.c:3483
void dai_unit_turn_end(struct ai_type *ait, struct unit *punit)
Definition daiunit.c:3339
void dai_unit_init(struct ai_type *ait, struct unit *punit)
Definition daiunit.c:3317
void dai_consider_tile_dangerous(struct ai_type *ait, struct tile *ptile, struct unit *punit, enum override_bool *result)
Definition daiunit.c:3127
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:3388
void dai_unit_close(struct ai_type *ait, struct unit *punit)
Definition daiunit.c:3351
void dai_units_ruleset_close(struct ai_type *ait)
Definition daiunit.c:3299
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:1063
adv_unit_task
Definition fc_types.h:229
override_bool
Definition fc_types.h:94
struct world wld
Definition game.c:62
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(* 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:317
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