Freeciv-3.1: /fast/freeciv/nightly/S3_1/ai/classic/classicai.c Source File

Freeciv-3.1

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 "aidata.h"
28#include "aiferry.h"
29#include "aihand.h"
30#include "ailog.h"
31#include "aiplayer.h"
32#include "aitools.h"
33#include "aiunit.h"
34#include "daicity.h"
35#include "daidiplomacy.h"
36#include "daidomestic.h"
37#include "daimilitary.h"
38#include "daisettler.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
46 static struct ai_type *self = NULL;
47
48/**********************************************************************/
51 static void classic_ai_set_self(struct ai_type *ai)
52{
53 self = ai;
54}
55
56/**********************************************************************/
59 static struct ai_type *classic_ai_get_self(void)
60{
61 return self;
62}
63
64/**********************************************************************/
67 const char *fc_ai_classic_capstr(void)
68{
69 return FC_AI_MOD_CAPSTR;
70}
71
72/**********************************************************************/
75 static void cai_module_close(void)
76{
77 struct ai_type *deftype = classic_ai_get_self();
78
79 FC_FREE(deftype->private);
80}
81
82/**********************************************************************/
85 static 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/**********************************************************************/
95 static 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/**********************************************************************/
106 static 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/**********************************************************************/
119 static 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/**********************************************************************/
132 static 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/**********************************************************************/
142 static 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, original, &(wld.map));
148}
149
150/**********************************************************************/
153 static 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/**********************************************************************/
164 static 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/**********************************************************************/
174 static 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/**********************************************************************/
184 static 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/**********************************************************************/
194 static 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/**********************************************************************/
204 static 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/**********************************************************************/
215 static 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/**********************************************************************/
226 static 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/**********************************************************************/
236 static 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/**********************************************************************/
246 static 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/**********************************************************************/
256 static 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/**********************************************************************/
266 static 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/**********************************************************************/
277 static 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/**********************************************************************/
287 static void cai_units_ruleset_close(void)
288{
289 struct ai_type *deftype = classic_ai_get_self();
290
291 dai_units_ruleset_close(deftype);
292}
293
294/**********************************************************************/
297 static 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/**********************************************************************/
307 static 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/**********************************************************************/
317 static 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/**********************************************************************/
327 static 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/**********************************************************************/
337 static 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/**********************************************************************/
347 static 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/**********************************************************************/
357 static 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/**********************************************************************/
368 static 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/**********************************************************************/
379 static 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/**********************************************************************/
390 static 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/**********************************************************************/
401 static 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/**********************************************************************/
411 static void cai_auto_settler_run(struct player *pplayer,
412 struct unit *punit,
413 struct settlermap *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/**********************************************************************/
423 static void cai_auto_settler_cont(struct player *pplayer,
424 struct unit *punit,
425 struct settlermap *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/**********************************************************************/
435 static 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/**********************************************************************/
446 static 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/**********************************************************************/
458 static void cai_restart_phase(struct player *pplayer)
459{
460 pplayer->ai_phase_done = TRUE;
461}
462
463/**********************************************************************/
466 static 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/**********************************************************************/
476 static 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/**********************************************************************/
486 static 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/**********************************************************************/
497 static 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/**********************************************************************/
508 static 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/**********************************************************************/
519 static void cai_incident(enum incident_type type,
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/**********************************************************************/
533 static 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/**********************************************************************/
543 static 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/**********************************************************************/
553 static 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/**********************************************************************/
564 static 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/**********************************************************************/
575 static 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/**********************************************************************/
585 bool fc_ai_classic_setup(struct ai_type *ai)
586{
587 struct dai_private_data *private;
588
589 classic_ai_set_self(ai);
590
591 strncpy(ai->name, "classic", sizeof(ai->name));
592
593 private = fc_malloc(sizeof(struct dai_private_data));
594 private->contemplace_workers = TRUE;
595 ai->private = private;
596
597 ai->funcs.module_close = cai_module_close;
598
599 /* ai->funcs.map_alloc = NULL; */
600 /* ai->funcs.map_ready = NULL; */
601 /* ai->funcs.map_free = NULL; */
602 /* ai->funcs.game_start = NULL; */
603 /* ai->funcs.game_free = NULL; */
604
605 ai->funcs.player_alloc = cai_player_alloc;
606 ai->funcs.player_free = cai_player_free;
607 /* ai->funcs.player_save = NULL; */
608 /* ai->funcs.player_load = NULL; */
609 ai->funcs.player_save_relations = cai_player_save_relations;
610 ai->funcs.player_load_relations = cai_player_load_relations;
611 ai->funcs.gained_control = cai_gained_control;
612 /* ai->funcs.lost_control = NULL; */
613 ai->funcs.split_by_civil_war = cai_split_by_civil_war;
614 ai->funcs.created_by_civil_war = cai_created_by_civil_war;
615
616 ai->funcs.phase_begin = cai_data_phase_begin;
617 ai->funcs.phase_finished = cai_data_phase_finished;
618
619 ai->funcs.city_alloc = cai_city_alloc;
620 ai->funcs.city_free = cai_city_free;
621 /*
622 ai->funcs.city_created = NULL;
623 ai->funcs.city_destroyed = NULL;
624 ai->funcs.city_got = NULL;
625 ai->funcs.city_lost = NULL;
626 */
627 ai->funcs.city_save = cai_city_save;
628 ai->funcs.city_load = cai_city_load;
629 ai->funcs.choose_building = cai_build_adv_override;
630 ai->funcs.build_adv_prepare = cai_wonder_city_distance;
631 ai->funcs.build_adv_init = cai_build_adv_init;
632 ai->funcs.build_adv_adjust_want = cai_build_adv_adjust;
633
634 ai->funcs.gov_value = cai_gov_value;
635
636 ai->funcs.units_ruleset_init = cai_units_ruleset_init;
637 ai->funcs.units_ruleset_close = cai_units_ruleset_close;
638
639 /* FIXME: We should allocate memory only for units owned by
640 default ai in unit_got. We track no data
641 about enemy units.
642 But advisors code still depends on some default ai data (role) to be
643 always allocated. */
644 /*
645 ai->funcs.unit_alloc = NULL;
646 ai->funcs.unit_free = NULL;
647 ai->funcs.unit_created = NULL;
648 ai->funcs.unit_destroyed = NULL;
649 ai->funcs.unit_got = dai_unit_init;
650 ai->funcs.unit_lost = dai_unit_close;
651 */
652 ai->funcs.unit_alloc = cai_unit_init;
653 ai->funcs.unit_free = cai_unit_close;
654 ai->funcs.unit_got = cai_ferry_init_ferry;
655 ai->funcs.unit_lost = cai_ferry_lost;
656 ai->funcs.unit_transformed = cai_ferry_transformed;
657
658 ai->funcs.unit_turn_end = cai_unit_turn_end;
659 ai->funcs.unit_move = cai_unit_move_or_attack;
660 /* ai->funcs.unit_move_seen = NULL; */
661 ai->funcs.unit_task = cai_unit_new_adv_task;
662
663 ai->funcs.unit_save = cai_unit_save;
664 ai->funcs.unit_load = cai_unit_load;
665
666 ai->funcs.settler_reset = cai_auto_settler_reset;
667 ai->funcs.settler_run = cai_auto_settler_run;
668 ai->funcs.settler_cont = cai_auto_settler_cont;
669
670 ai->funcs.want_to_explore = cai_switch_to_explore;
671
672 ai->funcs.first_activities = cai_do_first_activities;
673 ai->funcs.restart_phase = cai_restart_phase;
674 ai->funcs.diplomacy_actions = cai_diplomacy_actions;
675 ai->funcs.last_activities = cai_do_last_activities;
676 ai->funcs.treaty_evaluate = cai_treaty_evaluate;
677 ai->funcs.treaty_accepted = cai_treaty_accepted;
678 ai->funcs.first_contact = cai_diplomacy_first_contact;
679 ai->funcs.incident = cai_incident;
680
681 ai->funcs.log_fragment_city = cai_city_log;
682 ai->funcs.log_fragment_unit = cai_unit_log;
683
684 ai->funcs.consider_plr_dangerous = cai_consider_plr_dangerous;
685 ai->funcs.consider_tile_dangerous = cai_consider_tile_dangerous;
686 ai->funcs.consider_wonder_city = cai_consider_wonder_city;
687
688 /* ai->funcs.refresh = NULL; */
689
690 /* ai->funcs.tile_info = NULL; */
691 /* ai->funcs.city_info = NULL; */
692 /* ai->funcs.unit_info = NULL; */
693
694 return TRUE;
695}
advdata.h
ai.h
FC_AI_MOD_CAPSTR
#define FC_AI_MOD_CAPSTR
Definition ai.h:27
incident_type
incident_type
Definition ai.h:45
dai_gov_value
void dai_gov_value(struct ai_type *ait, struct player *pplayer, struct government *gov, adv_want *val, bool *override)
Definition aidata.c:524
dai_data_phase_begin
void dai_data_phase_begin(struct ai_type *ait, struct player *pplayer, bool is_new_phase)
Definition aidata.c:142
dai_data_phase_finished
void dai_data_phase_finished(struct ai_type *ait, struct player *pplayer)
Definition aidata.c:285
aidata.h
dai_ferry_lost
void dai_ferry_lost(struct ai_type *ait, struct unit *punit)
Definition aiferry.c:223
dai_ferry_transformed
void dai_ferry_transformed(struct ai_type *ait, struct unit *ferry, const struct unit_type *old)
Definition aiferry.c:191
dai_ferry_init_ferry
void dai_ferry_init_ferry(struct ai_type *ait, struct unit *ferry)
Definition aiferry.c:169
aiferry.h
dai_do_last_activities
void dai_do_last_activities(struct ai_type *ait, struct player *pplayer)
Definition aihand.c:774
dai_do_first_activities
void dai_do_first_activities(struct ai_type *ait, struct player *pplayer)
Definition aihand.c:748
aihand.h
dai_unit_log
void dai_unit_log(struct ai_type *ait, char *buffer, int buflength, const struct unit *punit)
Definition ailog.c:53
dai_city_log
void dai_city_log(struct ai_type *ait, char *buffer, int buflength, const struct city *pcity)
Definition ailog.c:40
ailog.h
dai_player_alloc
void dai_player_alloc(struct ai_type *ait, struct player *pplayer)
Definition aiplayer.c:37
dai_player_copy
void dai_player_copy(struct ai_type *ait, struct player *original, struct player *created)
Definition aiplayer.c:150
dai_player_save_relations
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 aiplayer.c:76
dai_player_free
void dai_player_free(struct ai_type *ait, struct player *pplayer)
Definition aiplayer.c:49
dai_gained_control
void dai_gained_control(struct ai_type *ait, struct player *pplayer)
Definition aiplayer.c:173
dai_player_load_relations
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 aiplayer.c:119
aiplayer.h
dai_build_adv_override
void dai_build_adv_override(struct ai_type *ait, struct city *pcity, struct adv_choice *choice)
Definition aitools.c:1349
dai_consider_plr_dangerous
void dai_consider_plr_dangerous(struct ai_type *ait, struct player *plr1, struct player *plr2, enum override_bool *result)
Definition aitools.c:142
dai_unit_new_adv_task
void dai_unit_new_adv_task(struct ai_type *ait, struct unit *punit, enum adv_unit_task task, struct tile *ptile)
Definition aitools.c:618
dai_unit_move_or_attack
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:1053
aitools.h
dai_unit_save
void dai_unit_save(struct ai_type *ait, const char *aitstr, struct section_file *file, const struct unit *punit, const char *unitstr)
Definition aiunit.c:3358
dai_units_ruleset_init
void dai_units_ruleset_init(struct ai_type *ait)
Definition aiunit.c:3197
dai_switch_to_explore
void dai_switch_to_explore(struct ai_type *ait, struct unit *punit, struct tile *target, enum override_bool *allow)
Definition aiunit.c:3471
dai_unit_turn_end
void dai_unit_turn_end(struct ai_type *ait, struct unit *punit)
Definition aiunit.c:3328
dai_unit_init
void dai_unit_init(struct ai_type *ait, struct unit *punit)
Definition aiunit.c:3306
dai_consider_tile_dangerous
void dai_consider_tile_dangerous(struct ai_type *ait, struct tile *ptile, struct unit *punit, enum override_bool *result)
Definition aiunit.c:3116
dai_unit_load
void dai_unit_load(struct ai_type *ait, const char *aitstr, const struct section_file *file, struct unit *punit, const char *unitstr)
Definition aiunit.c:3377
dai_unit_close
void dai_unit_close(struct ai_type *ait, struct unit *punit)
Definition aiunit.c:3340
dai_units_ruleset_close
void dai_units_ruleset_close(struct ai_type *ait)
Definition aiunit.c:3288
aiunit.h
autosettlers.h
cai_restart_phase
static void cai_restart_phase(struct player *pplayer)
Definition classicai.c:458
cai_city_log
static void cai_city_log(char *buffer, int buflength, const struct city *pcity)
Definition classicai.c:533
cai_ferry_lost
static void cai_ferry_lost(struct unit *punit)
Definition classicai.c:337
cai_city_free
static void cai_city_free(struct city *pcity)
Definition classicai.c:194
cai_player_load_relations
static void cai_player_load_relations(struct player *pplayer, struct player *other, const struct section_file *file, int plrno)
Definition classicai.c:119
cai_module_close
static void cai_module_close(void)
Definition classicai.c:75
fc_ai_classic_capstr
const char * fc_ai_classic_capstr(void)
Definition classicai.c:67
cai_units_ruleset_init
static void cai_units_ruleset_init(void)
Definition classicai.c:277
cai_city_alloc
static void cai_city_alloc(struct city *pcity)
Definition classicai.c:184
cai_wonder_city_distance
static void cai_wonder_city_distance(struct player *pplayer, struct adv_data *adv)
Definition classicai.c:236
cai_build_adv_adjust
static void cai_build_adv_adjust(struct player *pplayer, struct city *wonder_city)
Definition classicai.c:256
classic_ai_get_self
static struct ai_type * classic_ai_get_self(void)
Definition classicai.c:59
cai_diplomacy_first_contact
static void cai_diplomacy_first_contact(struct player *pplayer, struct player *aplayer)
Definition classicai.c:508
cai_units_ruleset_close
static void cai_units_ruleset_close(void)
Definition classicai.c:287
cai_unit_save
static void cai_unit_save(struct section_file *file, const struct unit *punit, const char *unitstr)
Definition classicai.c:379
cai_do_last_activities
static void cai_do_last_activities(struct player *pplayer)
Definition classicai.c:476
cai_unit_turn_end
static void cai_unit_turn_end(struct unit *punit)
Definition classicai.c:347
cai_player_alloc
static void cai_player_alloc(struct player *pplayer)
Definition classicai.c:85
cai_created_by_civil_war
static void cai_created_by_civil_war(struct player *original, struct player *created)
Definition classicai.c:153
cai_switch_to_explore
static void cai_switch_to_explore(struct unit *punit, struct tile *target, enum override_bool *allow)
Definition classicai.c:435
cai_gov_value
static void cai_gov_value(struct player *pplayer, struct government *gov, adv_want *val, bool *override)
Definition classicai.c:266
fc_ai_classic_setup
bool fc_ai_classic_setup(struct ai_type *ai)
Definition classicai.c:585
cai_data_phase_finished
static void cai_data_phase_finished(struct player *pplayer)
Definition classicai.c:174
cai_ferry_init_ferry
static void cai_ferry_init_ferry(struct unit *ferry)
Definition classicai.c:317
cai_auto_settler_run
static void cai_auto_settler_run(struct player *pplayer, struct unit *punit, struct settlermap *state)
Definition classicai.c:411
cai_unit_init
static void cai_unit_init(struct unit *punit)
Definition classicai.c:297
cai_diplomacy_actions
static void cai_diplomacy_actions(struct player *pplayer)
Definition classicai.c:466
cai_build_adv_init
static void cai_build_adv_init(struct player *pplayer)
Definition classicai.c:246
cai_data_phase_begin
static void cai_data_phase_begin(struct player *pplayer, bool is_new_phase)
Definition classicai.c:164
cai_incident
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
cai_consider_tile_dangerous
static void cai_consider_tile_dangerous(struct tile *ptile, struct unit *punit, enum override_bool *result)
Definition classicai.c:564
cai_unit_move_or_attack
static void cai_unit_move_or_attack(struct unit *punit, struct tile *ptile, struct pf_path *path, int step)
Definition classicai.c:357
cai_do_first_activities
static void cai_do_first_activities(struct player *pplayer)
Definition classicai.c:446
cai_gained_control
static void cai_gained_control(struct player *pplayer)
Definition classicai.c:132
cai_build_adv_override
static void cai_build_adv_override(struct city *pcity, struct adv_choice *choice)
Definition classicai.c:226
cai_city_load
static void cai_city_load(const struct section_file *file, struct city *pcity, const char *citystr)
Definition classicai.c:215
cai_unit_log
static void cai_unit_log(char *buffer, int buflength, const struct unit *punit)
Definition classicai.c:543
cai_treaty_accepted
static void cai_treaty_accepted(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition classicai.c:497
cai_ferry_transformed
static void cai_ferry_transformed(struct unit *ferry, const struct unit_type *old)
Definition classicai.c:327
cai_consider_wonder_city
static void cai_consider_wonder_city(struct city *pcity, bool *result)
Definition classicai.c:575
self
static struct ai_type * self
Definition classicai.c:46
cai_unit_load
static void cai_unit_load(const struct section_file *file, struct unit *punit, const char *unitstr)
Definition classicai.c:390
cai_treaty_evaluate
static void cai_treaty_evaluate(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition classicai.c:486
classic_ai_set_self
static void classic_ai_set_self(struct ai_type *ai)
Definition classicai.c:51
cai_player_free
static void cai_player_free(struct player *pplayer)
Definition classicai.c:95
cai_player_save_relations
static void cai_player_save_relations(struct player *pplayer, struct player *other, struct section_file *file, int plrno)
Definition classicai.c:106
cai_consider_plr_dangerous
static void cai_consider_plr_dangerous(struct player *plr1, struct player *plr2, enum override_bool *result)
Definition classicai.c:553
cai_unit_new_adv_task
static void cai_unit_new_adv_task(struct unit *punit, enum adv_unit_task task, struct tile *ptile)
Definition classicai.c:368
cai_auto_settler_cont
static void cai_auto_settler_cont(struct player *pplayer, struct unit *punit, struct settlermap *state)
Definition classicai.c:423
cai_auto_settler_reset
static void cai_auto_settler_reset(struct player *pplayer)
Definition classicai.c:401
cai_split_by_civil_war
static void cai_split_by_civil_war(struct player *original, struct player *created)
Definition classicai.c:142
cai_city_save
static void cai_city_save(struct section_file *file, const struct city *pcity, const char *citystr)
Definition classicai.c:204
cai_unit_close
static void cai_unit_close(struct unit *punit)
Definition classicai.c:307
classicai.h
dai_city_save
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
dai_city_load
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
dai_city_alloc
void dai_city_alloc(struct ai_type *ait, struct city *pcity)
Definition daicity.c:1111
dai_consider_wonder_city
void dai_consider_wonder_city(struct ai_type *ait, struct city *pcity, bool *result)
Definition daicity.c:2050
dai_build_adv_adjust
void dai_build_adv_adjust(struct ai_type *ait, struct player *pplayer, struct city *wonder_city)
Definition daicity.c:1935
dai_city_free
void dai_city_free(struct ai_type *ait, struct city *pcity)
Definition daicity.c:1124
dai_build_adv_init
void dai_build_adv_init(struct ai_type *ait, struct player *pplayer)
Definition daicity.c:1919
daicity.h
dai_treaty_accepted
void dai_treaty_accepted(struct ai_type *ait, struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition daidiplomacy.c:727
dai_incident
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)
Definition daidiplomacy.c:1930
dai_diplomacy_actions
void dai_diplomacy_actions(struct ai_type *ait, struct player *pplayer)
Definition daidiplomacy.c:1540
dai_treaty_evaluate
void dai_treaty_evaluate(struct ai_type *ait, struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition daidiplomacy.c:607
dai_diplomacy_first_contact
void dai_diplomacy_first_contact(struct ai_type *ait, struct player *pplayer, struct player *aplayer)
Definition daidiplomacy.c:947
daidiplomacy.h
dai_wonder_city_distance
void dai_wonder_city_distance(struct ai_type *ait, struct player *pplayer, struct adv_data *adv)
Definition daidomestic.c:644
daidomestic.h
dai_assess_danger_player
void dai_assess_danger_player(struct ai_type *ait, struct player *pplayer, const struct civ_map *dmap)
Definition daimilitary.c:613
daimilitary.h
dai_auto_settler_cont
void dai_auto_settler_cont(struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer, struct unit *punit, struct settlermap *state)
Definition daisettler.c:1204
dai_auto_settler_reset
void dai_auto_settler_reset(struct ai_type *ait, struct player *pplayer)
Definition daisettler.c:1217
dai_auto_settler_run
void dai_auto_settler_run(struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer, struct unit *punit, struct settlermap *state)
Definition daisettler.c:1030
daisettler.h
punit
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:73
adv_want
float adv_want
Definition fc_types.h:1206
adv_unit_task
adv_unit_task
Definition fc_types.h:340
override_bool
override_bool
Definition fc_types.h:84
wld
struct world wld
Definition game.c:58
type
GType type
Definition repodlgs.c:1312
FC_FREE
#define FC_FREE(ptr)
Definition mem.h:41
fc_malloc
#define fc_malloc(sz)
Definition mem.h:34
player.h
step
int step
Definition specpq.h:92
Treaty
Definition diptreaty.h:76
action
Definition actions.h:379
adv_choice
Definition advchoice.h:45
adv_data
Definition advdata.h:45
ai_type
Definition ai.h:50
ai_type::log_fragment_unit
void(* log_fragment_unit)(char *buffer, int buflength, const struct unit *punit)
Definition ai.h:287
ai_type::city_alloc
void(* city_alloc)(struct city *pcity)
Definition ai.h:128
ai_type::created_by_civil_war
void(* created_by_civil_war)(struct player *original, struct player *created)
Definition ai.h:117
ai_type::consider_tile_dangerous
void(* consider_tile_dangerous)(struct tile *ptile, struct unit *punit, enum override_bool *result)
Definition ai.h:294
ai_type::unit_lost
void(* unit_lost)(struct unit *punit)
Definition ai.h:205
ai_type::treaty_evaluate
void(* treaty_evaluate)(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition ai.h:260
ai_type::gov_value
void(* gov_value)(struct player *pplayer, struct government *gov, adv_want *val, bool *override)
Definition ai.h:173
ai_type::treaty_accepted
void(* treaty_accepted)(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition ai.h:265
ai_type::unit_transformed
void(* unit_transformed)(struct unit *punit, const struct unit_type *old_type)
Definition ai.h:202
ai_type::log_fragment_city
void(* log_fragment_city)(char *buffer, int buflength, const struct city *pcity)
Definition ai.h:283
ai_type::settler_run
void(* settler_run)(struct player *pplayer, struct unit *punit, struct settlermap *state)
Definition ai.h:233
ai_type::unit_load
void(* unit_load)(const struct section_file *file, struct unit *punit, const char *unitstr)
Definition ai.h:226
ai_type::unit_move
void(* unit_move)(struct unit *punit, struct tile *ptile, struct pf_path *path, int step)
Definition ai.h:211
ai_type::unit_free
void(* unit_free)(struct unit *punit)
Definition ai.h:188
ai_type::phase_finished
void(* phase_finished)(struct player *pplayer)
Definition ai.h:124
ai_type::restart_phase
void(* restart_phase)(struct player *pplayer)
Definition ai.h:250
ai_type::settler_reset
void(* settler_reset)(struct player *pplayer)
Definition ai.h:230
ai_type::unit_save
void(* unit_save)(struct section_file *file, const struct unit *punit, const char *unitstr)
Definition ai.h:222
ai_type::units_ruleset_close
void(* units_ruleset_close)(void)
Definition ai.h:180
ai_type::diplomacy_actions
void(* diplomacy_actions)(struct player *pplayer)
Definition ai.h:254
ai_type::player_alloc
void(* player_alloc)(struct player *pplayer)
Definition ai.h:77
ai_type::build_adv_prepare
void(* build_adv_prepare)(struct player *pplayer, struct adv_data *adv)
Definition ai.h:161
ai_type::build_adv_adjust_want
void(* build_adv_adjust_want)(struct player *pplayer, struct city *wonder_city)
Definition ai.h:170
ai_type::build_adv_init
void(* build_adv_init)(struct player *pplayer)
Definition ai.h:165
ai_type::unit_task
void(* unit_task)(struct unit *punit, enum adv_unit_task task, struct tile *ptile)
Definition ai.h:218
ai_type::last_activities
void(* last_activities)(struct player *pplayer)
Definition ai.h:257
ai_type::incident
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
ai_type::settler_cont
void(* settler_cont)(struct player *pplayer, struct unit *punit, struct settlermap *state)
Definition ai.h:238
ai_type::first_contact
void(* first_contact)(struct player *pplayer, struct player *aplayer)
Definition ai.h:272
ai_type::city_save
void(* city_save)(struct section_file *file, const struct city *pcity, const char *citystr)
Definition ai.h:149
ai_type::consider_wonder_city
void(* consider_wonder_city)(struct city *pcity, bool *result)
Definition ai.h:299
ai_type::city_free
void(* city_free)(struct city *pcity)
Definition ai.h:132
ai_type::choose_building
void(* choose_building)(struct city *pcity, struct adv_choice *choice)
Definition ai.h:158
ai_type::funcs
struct ai_type::@14 funcs
ai_type::player_save_relations
void(* player_save_relations)(struct player *pplayer, struct player *other, struct section_file *file, int plrno)
Definition ai.h:96
ai_type::module_close
void(* module_close)(void)
Definition ai.h:57
ai_type::city_load
void(* city_load)(const struct section_file *file, struct city *pcity, const char *citystr)
Definition ai.h:153
ai_type::player_load_relations
void(* player_load_relations)(struct player *pplayer, struct player *other, const struct section_file *file, int plrno)
Definition ai.h:101
ai_type::phase_begin
void(* phase_begin)(struct player *pplayer, bool new_phase)
Definition ai.h:121
ai_type::player_free
void(* player_free)(struct player *pplayer)
Definition ai.h:80
ai_type::split_by_civil_war
void(* split_by_civil_war)(struct player *original, struct player *created)
Definition ai.h:114
ai_type::unit_turn_end
void(* unit_turn_end)(struct unit *punit)
Definition ai.h:208
ai_type::unit_alloc
void(* unit_alloc)(struct unit *punit)
Definition ai.h:184
ai_type::gained_control
void(* gained_control)(struct player *pplayer)
Definition ai.h:108
ai_type::name
char name[MAX_LEN_NAME]
Definition ai.h:51
ai_type::unit_got
void(* unit_got)(struct unit *punit)
Definition ai.h:199
ai_type::private
void * private
Definition ai.h:53
ai_type::first_activities
void(* first_activities)(struct player *pplayer)
Definition ai.h:247
ai_type::consider_plr_dangerous
void(* consider_plr_dangerous)(struct player *plr1, struct player *plr2, enum override_bool *result)
Definition ai.h:290
ai_type::units_ruleset_init
void(* units_ruleset_init)(void)
Definition ai.h:177
ai_type::want_to_explore
void(* want_to_explore)(struct unit *punit, struct tile *target, enum override_bool *allow)
Definition ai.h:242
city
Definition city.h:309
dai_private_data
Definition aiplayer.h:61
government
Definition government.h:52
pf_path
Definition path_finding.h:344
player
Definition player.h:249
player::ai_phase_done
bool ai_phase_done
Definition player.h:264
section_file
Definition section_file.h:36
settlermap
Definition autosettlers.c:71
tile
Definition tile.h:49
unit_type
Definition unittype.h:481
unit
Definition unit.h:138
world::map
struct civ_map map
Definition world_object.h:38
TRUE
#define TRUE
Definition support.h:46