Freeciv-3.1: /fast/freeciv/nightly/S3_1/ai/tex/texai.c Source File

Freeciv-3.1

Loading...
Searching...
No Matches
texai.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
21/* ai/default */
22#include "aidata.h"
23#include "aiferry.h"
24#include "aihand.h"
25#include "ailog.h"
26#include "aiplayer.h"
27#include "aitools.h"
28#include "daicity.h"
29#include "daidiplomacy.h"
30#include "daidomestic.h"
31#include "daimilitary.h"
32#include "daisettler.h"
33
34/* tex ai */
35#include "texaicity.h"
36#include "texaimsg.h"
37#include "texaiplayer.h"
38#include "texaiworld.h"
39
40const char *fc_ai_tex_capstr(void);
41bool fc_ai_tex_setup(struct ai_type *ai);
42
43static void texai_init_self(struct ai_type *ai);
44
45 static struct ai_type *self = NULL;
46
47/**********************************************************************/
50 static void texai_init_self(struct ai_type *ai)
51{
52 self = ai;
53
54 texai_init_threading();
55}
56
57/**********************************************************************/
60 struct ai_type *texai_get_self(void)
61{
62 return self;
63}
64
65#define TEXAI_AIT struct ai_type *ait = texai_get_self();
66#define TEXAI_TFUNC(_func, ...) _func(ait, ## __VA_ARGS__ );
67#define TEXAI_DFUNC(_func, ...) _func(ait, ## __VA_ARGS__ );
68
69/**********************************************************************/
72 static void texai_module_close(void)
73{
74 TEXAI_AIT;
75
76 FC_FREE(ait->private);
77}
78
79/**********************************************************************/
82 static void texwai_player_alloc(struct player *pplayer)
83{
84 TEXAI_AIT;
85 TEXAI_TFUNC(texai_player_alloc, pplayer);
86 /* Do not call default AI here, texai_player_alloc() does necessary parts */
87}
88
89/**********************************************************************/
92 static void texwai_player_free(struct player *pplayer)
93{
94 TEXAI_AIT;
95 TEXAI_TFUNC(texai_player_free, pplayer);
96 /* Do not call default AI here, texai_player_free() does necessary parts */
97}
98
99/**********************************************************************/
102 static void texwai_player_save(struct player *pplayer,
103 struct section_file *file, int plrno)
104{
105 TEXAI_AIT;
106 TEXAI_DFUNC(dai_player_save, "texai", pplayer, file, plrno);
107}
108
109/**********************************************************************/
112 static void texwai_player_load(struct player *pplayer,
113 const struct section_file *file,
114 int plrno)
115{
116 TEXAI_AIT;
117 TEXAI_DFUNC(dai_player_load, "texai", pplayer, file, plrno);
118}
119
120/**********************************************************************/
123 static void texwai_control_gained(struct player *pplayer)
124{
125 TEXAI_AIT;
126 TEXAI_TFUNC(texai_control_gained, pplayer);
127 TEXAI_DFUNC(dai_gained_control, pplayer);
128}
129
130/**********************************************************************/
133 static void texwai_control_lost(struct player *pplayer)
134{
135 TEXAI_AIT;
136 TEXAI_TFUNC(texai_control_lost, pplayer);
137}
138
139/**********************************************************************/
142 static void texwai_split_by_civil_war(struct player *original,
143 struct player *created)
144{
145 TEXAI_AIT;
146 TEXAI_DFUNC(dai_assess_danger_player, original, &(wld.map));
147}
148
149/**********************************************************************/
152 static void texwai_created_by_civil_war(struct player *original,
153 struct player *created)
154{
155 TEXAI_AIT;
156 TEXAI_DFUNC(dai_player_copy, original, created);
157}
158
159/**********************************************************************/
162 static void texwai_phase_begin(struct player *pplayer, bool is_new_phase)
163{
164 TEXAI_AIT;
165 TEXAI_DFUNC(dai_data_phase_begin, pplayer, is_new_phase);
166}
167
168/**********************************************************************/
171 static void texwai_phase_finished(struct player *pplayer)
172{
173 TEXAI_AIT;
174 TEXAI_TFUNC(texai_phase_finished, pplayer);
175 TEXAI_DFUNC(dai_data_phase_finished, pplayer);
176}
177
178/**********************************************************************/
181 static void texwai_city_alloc(struct city *pcity)
182{
183 TEXAI_AIT;
184 TEXAI_DFUNC(texai_city_alloc, pcity);
185}
186
187/**********************************************************************/
190 static void texwai_city_free(struct city *pcity)
191{
192 TEXAI_AIT;
193 TEXAI_DFUNC(texai_city_free, pcity);
194}
195
196/**********************************************************************/
199 static void texwai_city_save(struct section_file *file,
200 const struct city *pcity, const char *citystr)
201{
202 TEXAI_AIT;
203 TEXAI_DFUNC(dai_city_save, "texai", file, pcity, citystr);
204}
205
206/**********************************************************************/
209 static void texwai_city_load(const struct section_file *file,
210 struct city *pcity, const char *citystr)
211{
212 TEXAI_AIT;
213 TEXAI_DFUNC(dai_city_load, "texai", file, pcity, citystr);
214}
215
216/**********************************************************************/
219 static void texwai_build_adv_override(struct city *pcity,
220 struct adv_choice *choice)
221{
222 TEXAI_AIT;
223 TEXAI_DFUNC(dai_build_adv_override, pcity, choice);
224}
225
226/**********************************************************************/
229 static void texwai_wonder_city_distance(struct player *pplayer,
230 struct adv_data *adv)
231{
232 TEXAI_AIT;
233 TEXAI_DFUNC(dai_wonder_city_distance, pplayer, adv);
234}
235
236/**********************************************************************/
239 static void texwai_build_adv_init(struct player *pplayer)
240{
241 TEXAI_AIT;
242 TEXAI_DFUNC(dai_build_adv_init, pplayer);
243}
244
245/**********************************************************************/
248 static void texwai_build_adv_adjust(struct player *pplayer,
249 struct city *wonder_city)
250{
251 TEXAI_AIT;
252 TEXAI_DFUNC(dai_build_adv_adjust, pplayer, wonder_city);
253}
254
255/**********************************************************************/
258 static void texwai_gov_value(struct player *pplayer, struct government *gov,
259 adv_want *val, bool *override)
260{
261 TEXAI_AIT;
262 TEXAI_DFUNC(dai_gov_value, pplayer, gov, val, override);
263}
264
265/**********************************************************************/
268 static void texwai_units_ruleset_init(void)
269{
270 TEXAI_AIT;
271 TEXAI_DFUNC(dai_units_ruleset_init);
272}
273
274/**********************************************************************/
277 static void texwai_units_ruleset_close(void)
278{
279 TEXAI_AIT;
280 TEXAI_DFUNC(dai_units_ruleset_close);
281}
282
283/**********************************************************************/
286 static void texwai_unit_alloc(struct unit *punit)
287{
288 TEXAI_AIT;
289 TEXAI_DFUNC(dai_unit_init, punit);
290}
291
292/**********************************************************************/
295 static void texwai_unit_free(struct unit *punit)
296{
297 TEXAI_AIT;
298 TEXAI_DFUNC(dai_unit_close, punit);
299}
300
301/**********************************************************************/
304 static void texwai_ferry_init_ferry(struct unit *ferry)
305{
306 TEXAI_AIT;
307 TEXAI_DFUNC(dai_ferry_init_ferry, ferry);
308}
309
310/**********************************************************************/
313 static void texwai_ferry_transformed(struct unit *ferry,
314 const struct unit_type *old)
315{
316 TEXAI_AIT;
317 TEXAI_DFUNC(dai_ferry_transformed, ferry, old);
318}
319
320/**********************************************************************/
323 static void texwai_ferry_lost(struct unit *punit)
324{
325 TEXAI_AIT;
326 TEXAI_DFUNC(dai_ferry_lost, punit);
327}
328
329/**********************************************************************/
332 static void texwai_unit_turn_end(struct unit *punit)
333{
334 TEXAI_AIT;
335 TEXAI_DFUNC(dai_unit_turn_end, punit);
336}
337
338/**********************************************************************/
341 static void texwai_unit_move_or_attack(struct unit *punit,
342 struct tile *ptile,
343 struct pf_path *path, int step)
344{
345 TEXAI_AIT;
346 TEXAI_DFUNC(dai_unit_move_or_attack, punit, ptile, path, step);
347}
348
349/**********************************************************************/
352 static void texwai_unit_new_adv_task(struct unit *punit,
353 enum adv_unit_task task,
354 struct tile *ptile)
355{
356 TEXAI_AIT;
357 TEXAI_DFUNC(dai_unit_new_adv_task, punit, task, ptile);
358}
359
360/**********************************************************************/
363 static void texwai_unit_save(struct section_file *file,
364 const struct unit *punit, const char *unitstr)
365{
366 TEXAI_AIT;
367 TEXAI_DFUNC(dai_unit_save, "texai", file, punit, unitstr);
368}
369
370/**********************************************************************/
373 static void texwai_unit_load(const struct section_file *file,
374 struct unit *punit, const char *unitstr)
375{
376 TEXAI_AIT;
377 TEXAI_DFUNC(dai_unit_load, "texai", file, punit, unitstr);
378}
379
380/**********************************************************************/
383 static void texwai_auto_settler_reset(struct player *pplayer)
384{
385 TEXAI_AIT;
386 TEXAI_DFUNC(dai_auto_settler_reset, pplayer);
387}
388
389/**********************************************************************/
392 static void texwai_auto_settler_run(struct player *pplayer,
393 struct unit *punit,
394 struct settlermap *state)
395{
396 TEXAI_AIT;
397
398 /* TODO: Operate on tex map */
399 TEXAI_DFUNC(dai_auto_settler_run, &(wld.map), pplayer, punit, state);
400}
401
402/**********************************************************************/
405 static void texwai_auto_settler_cont(struct player *pplayer,
406 struct unit *punit,
407 struct settlermap *state)
408{
409 TEXAI_AIT;
410
411 /* TODO: Operate on tex map */
412 TEXAI_DFUNC(dai_auto_settler_cont, &(wld.map), pplayer, punit, state);
413}
414
415/**********************************************************************/
418 static void texwai_switch_to_explore(struct unit *punit, struct tile *target,
419 enum override_bool *allow)
420{
421 TEXAI_AIT;
422 TEXAI_DFUNC(dai_switch_to_explore, punit, target, allow);
423}
424
425/**********************************************************************/
428 static void texwai_first_activities(struct player *pplayer)
429{
430 TEXAI_AIT;
431 TEXAI_TFUNC(texai_first_activities, pplayer);
432 TEXAI_DFUNC(dai_do_first_activities, pplayer);
433}
434
435/**********************************************************************/
438 static void texwai_restart_phase(struct player *pplayer)
439{
440 TEXAI_AIT;
441 TEXAI_TFUNC(texai_first_activities, pplayer);
442}
443
444/**********************************************************************/
447 static void texwai_diplomacy_actions(struct player *pplayer)
448{
449 TEXAI_AIT;
450 TEXAI_DFUNC(dai_diplomacy_actions, pplayer);
451}
452
453/**********************************************************************/
456 static void texwai_last_activities(struct player *pplayer)
457{
458 TEXAI_AIT;
459 TEXAI_DFUNC(dai_do_last_activities, pplayer);
460}
461
462/**********************************************************************/
465 static void texwai_treaty_evaluate(struct player *pplayer,
466 struct player *aplayer,
467 struct Treaty *ptreaty)
468{
469 TEXAI_AIT;
470 TEXAI_DFUNC(dai_treaty_evaluate, pplayer, aplayer, ptreaty);
471}
472
473/**********************************************************************/
476 static void texwai_treaty_accepted(struct player *pplayer,
477 struct player *aplayer,
478 struct Treaty *ptreaty)
479{
480 TEXAI_AIT;
481 TEXAI_DFUNC(dai_treaty_accepted, pplayer, aplayer, ptreaty);
482}
483
484/**********************************************************************/
487 static void texwai_diplomacy_first_contact(struct player *pplayer,
488 struct player *aplayer)
489{
490 TEXAI_AIT;
491 TEXAI_DFUNC(dai_diplomacy_first_contact, pplayer, aplayer);
492}
493
494/**********************************************************************/
497 static void texwai_incident(enum incident_type type,
498 enum casus_belli_range scope,
499 const struct action *paction,
500 struct player *receiver,
501 struct player *violator, struct player *victim)
502{
503 TEXAI_AIT;
504 TEXAI_DFUNC(dai_incident, type, scope, paction,
505 receiver, violator, victim);
506}
507
508/**********************************************************************/
511 static void texwai_city_log(char *buffer, int buflength,
512 const struct city *pcity)
513{
514 TEXAI_AIT;
515 TEXAI_DFUNC(dai_city_log, buffer, buflength, pcity);
516}
517
518/**********************************************************************/
521 static void texwai_unit_log(char *buffer, int buflength,
522 const struct unit *punit)
523{
524 TEXAI_AIT;
525 TEXAI_DFUNC(dai_unit_log, buffer, buflength, punit);
526}
527
528/**********************************************************************/
531 static void texwai_consider_plr_dangerous(struct player *plr1,
532 struct player *plr2,
533 enum override_bool *result)
534{
535 TEXAI_AIT;
536 TEXAI_DFUNC(dai_consider_plr_dangerous, plr1, plr2, result);
537}
538
539/**********************************************************************/
542 static void texwai_consider_tile_dangerous(struct tile *ptile,
543 struct unit *punit,
544 enum override_bool *result)
545{
546 TEXAI_AIT;
547 TEXAI_DFUNC(dai_consider_tile_dangerous, ptile, punit, result);
548}
549
550/**********************************************************************/
553 static void texwai_consider_wonder_city(struct city *pcity, bool *result)
554{
555 TEXAI_AIT;
556 TEXAI_DFUNC(dai_consider_wonder_city, pcity, result);
557}
558
559/**********************************************************************/
562 static void texwai_refresh(struct player *pplayer)
563{
564 TEXAI_AIT;
565 TEXAI_TFUNC(texai_refresh, pplayer);
566}
567
568/**********************************************************************/
571 const char *fc_ai_tex_capstr(void)
572{
573 return FC_AI_MOD_CAPSTR;
574}
575
576/**********************************************************************/
579 bool fc_ai_tex_setup(struct ai_type *ai)
580{
581 struct dai_private_data *private;
582
583 if (!has_thread_cond_impl()) {
584 log_error(_("This Freeciv compilation has no full threads "
585 "implementation, tex ai cannot be used."));
586 return FALSE;
587 }
588
589 strncpy(ai->name, "tex", sizeof(ai->name));
590
591 private = fc_malloc(sizeof(struct dai_private_data));
592 private->contemplace_workers = FALSE; /* We use custom code to set worker want and type */
593 ai->private = private;
594
595 texai_init_self(ai);
596
597 ai->funcs.module_close = texai_module_close;
598
599 ai->funcs.map_alloc = texai_map_alloc;
600 ai->funcs.map_ready = texai_whole_map_copy;
601 ai->funcs.map_free = texai_map_free;
602
603 ai->funcs.player_alloc = texwai_player_alloc;
604 ai->funcs.player_free = texwai_player_free;
605 ai->funcs.player_save = texwai_player_save;
606 ai->funcs.player_load = texwai_player_load;
607 ai->funcs.gained_control = texwai_control_gained;
608 ai->funcs.lost_control = texwai_control_lost;
609 ai->funcs.split_by_civil_war = texwai_split_by_civil_war;
610 ai->funcs.created_by_civil_war = texwai_created_by_civil_war;
611
612 ai->funcs.phase_begin = texwai_phase_begin;
613 ai->funcs.phase_finished = texwai_phase_finished;
614
615 ai->funcs.city_alloc = texwai_city_alloc;
616 ai->funcs.city_free = texwai_city_free;
617 ai->funcs.city_created = texai_city_created;
618 ai->funcs.city_destroyed = texai_city_destroyed;
619 ai->funcs.city_save = texwai_city_save;
620 ai->funcs.city_load = texwai_city_load;
621 ai->funcs.choose_building = texwai_build_adv_override;
622 ai->funcs.build_adv_prepare = texwai_wonder_city_distance;
623 ai->funcs.build_adv_init = texwai_build_adv_init;
624 ai->funcs.build_adv_adjust_want = texwai_build_adv_adjust;
625
626 ai->funcs.gov_value = texwai_gov_value;
627
628 ai->funcs.units_ruleset_init = texwai_units_ruleset_init;
629 ai->funcs.units_ruleset_close = texwai_units_ruleset_close;
630
631 ai->funcs.unit_alloc = texwai_unit_alloc;
632 ai->funcs.unit_free = texwai_unit_free;
633
634 ai->funcs.unit_created = texai_unit_created;
635 ai->funcs.unit_destroyed = texai_unit_destroyed;
636
637 ai->funcs.unit_got = texwai_ferry_init_ferry;
638 ai->funcs.unit_lost = texwai_ferry_lost;
639 ai->funcs.unit_transformed = texwai_ferry_transformed;
640
641 ai->funcs.unit_turn_end = texwai_unit_turn_end;
642 ai->funcs.unit_move = texwai_unit_move_or_attack;
643 ai->funcs.unit_move_seen = texai_unit_move_seen;
644 ai->funcs.unit_task = texwai_unit_new_adv_task;
645
646 ai->funcs.unit_save = texwai_unit_save;
647 ai->funcs.unit_load = texwai_unit_load;
648
649 ai->funcs.settler_reset = texwai_auto_settler_reset;
650 ai->funcs.settler_run = texwai_auto_settler_run;
651 ai->funcs.settler_cont = texwai_auto_settler_cont;
652
653 ai->funcs.want_to_explore = texwai_switch_to_explore;
654
655 ai->funcs.first_activities = texwai_first_activities;
656 ai->funcs.restart_phase = texwai_restart_phase;
657 ai->funcs.diplomacy_actions = texwai_diplomacy_actions;
658 ai->funcs.last_activities = texwai_last_activities;
659
660 ai->funcs.treaty_evaluate = texwai_treaty_evaluate;
661 ai->funcs.treaty_accepted = texwai_treaty_accepted;
662 ai->funcs.first_contact = texwai_diplomacy_first_contact;
663 ai->funcs.incident = texwai_incident;
664
665 ai->funcs.log_fragment_city = texwai_city_log;
666 ai->funcs.log_fragment_unit = texwai_unit_log;
667
668 ai->funcs.consider_plr_dangerous = texwai_consider_plr_dangerous;
669 ai->funcs.consider_tile_dangerous = texwai_consider_tile_dangerous;
670 ai->funcs.consider_wonder_city = texwai_consider_wonder_city;
671
672 ai->funcs.refresh = texwai_refresh;
673
674 ai->funcs.tile_info = texai_tile_info;
675 ai->funcs.city_info = texai_city_changed;
676 ai->funcs.unit_info = texai_unit_changed;
677
678 return TRUE;
679}
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_save
void dai_player_save(struct ai_type *ait, const char *aitstr, struct player *pplayer, struct section_file *file, int plrno)
Definition aiplayer.c:64
dai_player_copy
void dai_player_copy(struct ai_type *ait, struct player *original, struct player *created)
Definition aiplayer.c:150
dai_player_load
void dai_player_load(struct ai_type *ait, const char *aitstr, struct player *pplayer, const struct section_file *file, int plrno)
Definition aiplayer.c:107
dai_gained_control
void dai_gained_control(struct ai_type *ait, struct player *pplayer)
Definition aiplayer.c:173
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:3361
dai_units_ruleset_init
void dai_units_ruleset_init(struct ai_type *ait)
Definition aiunit.c:3200
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:3474
dai_unit_turn_end
void dai_unit_turn_end(struct ai_type *ait, struct unit *punit)
Definition aiunit.c:3331
dai_unit_init
void dai_unit_init(struct ai_type *ait, struct unit *punit)
Definition aiunit.c:3309
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:3119
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:3380
dai_unit_close
void dai_unit_close(struct ai_type *ait, struct unit *punit)
Definition aiunit.c:3343
dai_units_ruleset_close
void dai_units_ruleset_close(struct ai_type *ait)
Definition aiunit.c:3291
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_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_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:1205
dai_auto_settler_reset
void dai_auto_settler_reset(struct ai_type *ait, struct player *pplayer)
Definition daisettler.c:1218
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:1031
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
_
#define _(String)
Definition fcintl.h:67
has_thread_cond_impl
bool has_thread_cond_impl(void)
Definition fcthread.c:405
wld
struct world wld
Definition game.c:58
type
GType type
Definition repodlgs.c:1312
log_error
#define log_error(message,...)
Definition log.h:103
FC_FREE
#define FC_FREE(ptr)
Definition mem.h:41
fc_malloc
#define fc_malloc(sz)
Definition mem.h:34
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::map_alloc
void(* map_alloc)(void)
Definition ai.h:67
ai_type::phase_finished
void(* phase_finished)(struct player *pplayer)
Definition ai.h:124
ai_type::tile_info
void(* tile_info)(struct tile *ptile)
Definition ai.h:305
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::refresh
void(* refresh)(struct player *pplayer)
Definition ai.h:302
ai_type::unit_created
void(* unit_created)(struct unit *punit)
Definition ai.h:192
ai_type::units_ruleset_close
void(* units_ruleset_close)(void)
Definition ai.h:180
ai_type::unit_info
void(* unit_info)(struct unit *punit)
Definition ai.h:317
ai_type::city_destroyed
void(* city_destroyed)(struct city *pcity)
Definition ai.h:140
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::city_info
void(* city_info)(struct city *pcity)
Definition ai.h:311
ai_type::player_load
void(* player_load)(struct player *pplayer, const struct section_file *file, int plrno)
Definition ai.h:87
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::map_free
void(* map_free)(void)
Definition ai.h:74
ai_type::city_created
void(* city_created)(struct city *pcity)
Definition ai.h:136
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::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::unit_destroyed
void(* unit_destroyed)(struct unit *punit)
Definition ai.h:196
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::map_ready
void(* map_ready)(void)
Definition ai.h:71
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::player_save
void(* player_save)(struct player *pplayer, struct section_file *file, int plrno)
Definition ai.h:83
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::lost_control
void(* lost_control)(struct player *pplayer)
Definition ai.h:111
ai_type::units_ruleset_init
void(* units_ruleset_init)(void)
Definition ai.h:177
ai_type::unit_move_seen
void(* unit_move_seen)(struct unit *punit)
Definition ai.h:215
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
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
FALSE
#define FALSE
Definition support.h:47
texwai_created_by_civil_war
static void texwai_created_by_civil_war(struct player *original, struct player *created)
Definition texai.c:152
texwai_unit_load
static void texwai_unit_load(const struct section_file *file, struct unit *punit, const char *unitstr)
Definition texai.c:373
texwai_player_alloc
static void texwai_player_alloc(struct player *pplayer)
Definition texai.c:82
fc_ai_tex_capstr
const char * fc_ai_tex_capstr(void)
Definition texai.c:571
texwai_diplomacy_first_contact
static void texwai_diplomacy_first_contact(struct player *pplayer, struct player *aplayer)
Definition texai.c:487
fc_ai_tex_setup
bool fc_ai_tex_setup(struct ai_type *ai)
Definition texai.c:579
texwai_ferry_transformed
static void texwai_ferry_transformed(struct unit *ferry, const struct unit_type *old)
Definition texai.c:313
texwai_city_alloc
static void texwai_city_alloc(struct city *pcity)
Definition texai.c:181
texwai_unit_new_adv_task
static void texwai_unit_new_adv_task(struct unit *punit, enum adv_unit_task task, struct tile *ptile)
Definition texai.c:352
texwai_restart_phase
static void texwai_restart_phase(struct player *pplayer)
Definition texai.c:438
texwai_treaty_evaluate
static void texwai_treaty_evaluate(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition texai.c:465
texwai_auto_settler_reset
static void texwai_auto_settler_reset(struct player *pplayer)
Definition texai.c:383
texwai_consider_plr_dangerous
static void texwai_consider_plr_dangerous(struct player *plr1, struct player *plr2, enum override_bool *result)
Definition texai.c:531
texwai_build_adv_init
static void texwai_build_adv_init(struct player *pplayer)
Definition texai.c:239
texwai_first_activities
static void texwai_first_activities(struct player *pplayer)
Definition texai.c:428
texwai_phase_finished
static void texwai_phase_finished(struct player *pplayer)
Definition texai.c:171
TEXAI_TFUNC
#define TEXAI_TFUNC(_func,...)
Definition texai.c:66
texwai_phase_begin
static void texwai_phase_begin(struct player *pplayer, bool is_new_phase)
Definition texai.c:162
texwai_gov_value
static void texwai_gov_value(struct player *pplayer, struct government *gov, adv_want *val, bool *override)
Definition texai.c:258
texwai_wonder_city_distance
static void texwai_wonder_city_distance(struct player *pplayer, struct adv_data *adv)
Definition texai.c:229
texwai_unit_log
static void texwai_unit_log(char *buffer, int buflength, const struct unit *punit)
Definition texai.c:521
texwai_city_log
static void texwai_city_log(char *buffer, int buflength, const struct city *pcity)
Definition texai.c:511
texwai_auto_settler_cont
static void texwai_auto_settler_cont(struct player *pplayer, struct unit *punit, struct settlermap *state)
Definition texai.c:405
texwai_city_free
static void texwai_city_free(struct city *pcity)
Definition texai.c:190
TEXAI_DFUNC
#define TEXAI_DFUNC(_func,...)
Definition texai.c:67
texwai_build_adv_override
static void texwai_build_adv_override(struct city *pcity, struct adv_choice *choice)
Definition texai.c:219
texwai_switch_to_explore
static void texwai_switch_to_explore(struct unit *punit, struct tile *target, enum override_bool *allow)
Definition texai.c:418
texwai_last_activities
static void texwai_last_activities(struct player *pplayer)
Definition texai.c:456
texwai_ferry_init_ferry
static void texwai_ferry_init_ferry(struct unit *ferry)
Definition texai.c:304
texwai_unit_turn_end
static void texwai_unit_turn_end(struct unit *punit)
Definition texai.c:332
texwai_consider_tile_dangerous
static void texwai_consider_tile_dangerous(struct tile *ptile, struct unit *punit, enum override_bool *result)
Definition texai.c:542
texwai_city_save
static void texwai_city_save(struct section_file *file, const struct city *pcity, const char *citystr)
Definition texai.c:199
texwai_unit_alloc
static void texwai_unit_alloc(struct unit *punit)
Definition texai.c:286
texwai_unit_free
static void texwai_unit_free(struct unit *punit)
Definition texai.c:295
texai_init_self
static void texai_init_self(struct ai_type *ai)
Definition texai.c:50
texwai_split_by_civil_war
static void texwai_split_by_civil_war(struct player *original, struct player *created)
Definition texai.c:142
texai_get_self
struct ai_type * texai_get_self(void)
Definition texai.c:60
texwai_player_load
static void texwai_player_load(struct player *pplayer, const struct section_file *file, int plrno)
Definition texai.c:112
texwai_city_load
static void texwai_city_load(const struct section_file *file, struct city *pcity, const char *citystr)
Definition texai.c:209
TEXAI_AIT
#define TEXAI_AIT
Definition texai.c:65
texwai_units_ruleset_close
static void texwai_units_ruleset_close(void)
Definition texai.c:277
self
static struct ai_type * self
Definition texai.c:45
texwai_player_free
static void texwai_player_free(struct player *pplayer)
Definition texai.c:92
texwai_unit_move_or_attack
static void texwai_unit_move_or_attack(struct unit *punit, struct tile *ptile, struct pf_path *path, int step)
Definition texai.c:341
texwai_build_adv_adjust
static void texwai_build_adv_adjust(struct player *pplayer, struct city *wonder_city)
Definition texai.c:248
texwai_consider_wonder_city
static void texwai_consider_wonder_city(struct city *pcity, bool *result)
Definition texai.c:553
texwai_units_ruleset_init
static void texwai_units_ruleset_init(void)
Definition texai.c:268
texwai_control_gained
static void texwai_control_gained(struct player *pplayer)
Definition texai.c:123
texwai_unit_save
static void texwai_unit_save(struct section_file *file, const struct unit *punit, const char *unitstr)
Definition texai.c:363
texwai_player_save
static void texwai_player_save(struct player *pplayer, struct section_file *file, int plrno)
Definition texai.c:102
texai_module_close
static void texai_module_close(void)
Definition texai.c:72
texwai_ferry_lost
static void texwai_ferry_lost(struct unit *punit)
Definition texai.c:323
texwai_control_lost
static void texwai_control_lost(struct player *pplayer)
Definition texai.c:133
texwai_incident
static void texwai_incident(enum incident_type type, enum casus_belli_range scope, const struct action *paction, struct player *receiver, struct player *violator, struct player *victim)
Definition texai.c:497
texwai_treaty_accepted
static void texwai_treaty_accepted(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition texai.c:476
texwai_refresh
static void texwai_refresh(struct player *pplayer)
Definition texai.c:562
texwai_auto_settler_run
static void texwai_auto_settler_run(struct player *pplayer, struct unit *punit, struct settlermap *state)
Definition texai.c:392
texwai_diplomacy_actions
static void texwai_diplomacy_actions(struct player *pplayer)
Definition texai.c:447
texai_city_alloc
void texai_city_alloc(struct ai_type *ait, struct city *pcity)
Definition texaicity.c:564
texai_city_free
void texai_city_free(struct ai_type *ait, struct city *pcity)
Definition texaicity.c:577
texaicity.h
texai_first_activities
void texai_first_activities(struct ai_type *ait, struct player *pplayer)
Definition texaimsg.c:63
texai_phase_finished
void texai_phase_finished(struct ai_type *ait, struct player *pplayer)
Definition texaimsg.c:71
texaimsg.h
texai_player_alloc
void texai_player_alloc(struct ai_type *ait, struct player *pplayer)
Definition texaiplayer.c:278
texai_control_gained
void texai_control_gained(struct ai_type *ait, struct player *pplayer)
Definition texaiplayer.c:312
texai_player_free
void texai_player_free(struct ai_type *ait, struct player *pplayer)
Definition texaiplayer.c:294
texai_control_lost
void texai_control_lost(struct ai_type *ait, struct player *pplayer)
Definition texaiplayer.c:343
texai_refresh
void texai_refresh(struct ai_type *ait, struct player *pplayer)
Definition texaiplayer.c:366
texai_init_threading
void texai_init_threading(void)
Definition texaiplayer.c:73
texai_map_alloc
void texai_map_alloc(void)
Definition texaiplayer.c:114
texai_whole_map_copy
void texai_whole_map_copy(void)
Definition texaiplayer.c:122
texai_map_free
void texai_map_free(void)
Definition texaiplayer.c:140
texaiplayer.h
texai_city_created
void texai_city_created(struct city *pcity)
Definition texaiworld.c:161
texai_city_destroyed
void texai_city_destroyed(struct city *pcity)
Definition texaiworld.c:226
texai_unit_destroyed
void texai_unit_destroyed(struct unit *punit)
Definition texaiworld.c:338
texai_unit_changed
void texai_unit_changed(struct unit *punit)
Definition texaiworld.c:291
texai_tile_info
void texai_tile_info(struct tile *ptile)
Definition texaiworld.c:110
texai_city_changed
void texai_city_changed(struct city *pcity)
Definition texaiworld.c:169
texai_unit_move_seen
void texai_unit_move_seen(struct unit *punit)
Definition texaiworld.c:376
texai_unit_created
void texai_unit_created(struct unit *punit)
Definition texaiworld.c:283
texaiworld.h