Freeciv-3.3: /fast/freeciv/nightly/main/ai/tex/texai.c Source File

Freeciv-3.3

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