Freeciv-3.1
Loading...
Searching...
No Matches
threadedai.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/* threaded ai */
35#include "taimsg.h"
36#include "taiplayer.h"
37
38const char *fc_ai_threaded_capstr(void);
39bool fc_ai_threaded_setup(struct ai_type *ai);
40
41static void tai_init_self(struct ai_type *ai);
42static struct ai_type *tai_get_self(void);
43
44static struct ai_type *self = NULL;
45
46/**********************************************************************/
49static void tai_init_self(struct ai_type *ai)
50{
51 self = ai;
52
54}
55
56/**********************************************************************/
59static struct ai_type *tai_get_self(void)
60{
61 return self;
62}
63
64#define TAI_AIT struct ai_type *ait = tai_get_self();
65#define TAI_TFUNC(_func, ...) _func(ait, ## __VA_ARGS__ );
66#define TAI_DFUNC(_func, ...) _func(ait, ## __VA_ARGS__ );
67
68/**********************************************************************/
71static void tai_module_close(void)
72{
73 TAI_AIT;
74
75 FC_FREE(ait->private);
76}
77
78/**********************************************************************/
81static void twai_player_alloc(struct player *pplayer)
82{
83 TAI_AIT;
85 /* Do not call default AI here, tai_player_alloc() does necessary parts */
86}
87
88/**********************************************************************/
91static void twai_player_free(struct player *pplayer)
92{
93 TAI_AIT;
94 TAI_TFUNC(tai_player_free, pplayer);
95 /* Do not call default AI here, tai_player_free() does necessary parts */
96}
97
98/**********************************************************************/
101static void twai_player_save(struct player *pplayer, struct section_file *file,
102 int plrno)
103{
104 TAI_AIT;
105 TAI_DFUNC(dai_player_save, "tai", pplayer, file, plrno);
106}
107
108/**********************************************************************/
111static void twai_player_load(struct player *pplayer,
112 const struct section_file *file,
113 int plrno)
114{
115 TAI_AIT;
116 TAI_DFUNC(dai_player_load, "tai", pplayer, file, plrno);
117}
118
119/**********************************************************************/
122static void twai_control_gained(struct player *pplayer)
123{
124 TAI_AIT;
127}
128
129/**********************************************************************/
132static void twai_control_lost(struct player *pplayer)
133{
134 TAI_AIT;
135 TAI_TFUNC(tai_control_lost, pplayer);
136}
137
138/**********************************************************************/
141static void twai_split_by_civil_war(struct player *original,
142 struct player *created)
143{
144 TAI_AIT;
146}
147
148/**********************************************************************/
151static void twai_created_by_civil_war(struct player *original,
152 struct player *created)
153{
154 TAI_AIT;
155 TAI_DFUNC(dai_player_copy, original, created);
156}
157
158/**********************************************************************/
161static void twai_phase_begin(struct player *pplayer, bool is_new_phase)
162{
163 TAI_AIT;
164 TAI_DFUNC(dai_data_phase_begin, pplayer, is_new_phase);
165}
166
167/**********************************************************************/
170static void twai_phase_finished(struct player *pplayer)
171{
172 TAI_AIT;
175}
176
177/**********************************************************************/
180static void twai_city_alloc(struct city *pcity)
181{
182 TAI_AIT;
184}
185
186/**********************************************************************/
189static void twai_city_free(struct city *pcity)
190{
191 TAI_AIT;
192 TAI_DFUNC(dai_city_free, pcity);
193}
194
195/**********************************************************************/
198static void twai_city_save(struct section_file *file, const struct city *pcity,
199 const char *citystr)
200{
201 TAI_AIT;
202 TAI_DFUNC(dai_city_save, "tai", file, pcity, citystr);
203}
204
205/**********************************************************************/
208static void twai_city_load(const struct section_file *file, struct city *pcity,
209 const char *citystr)
210{
211 TAI_AIT;
212 TAI_DFUNC(dai_city_load, "tai", file, pcity, citystr);
213}
214
215/**********************************************************************/
218static void twai_build_adv_override(struct city *pcity, struct adv_choice *choice)
219{
220 TAI_AIT;
221 TAI_DFUNC(dai_build_adv_override, pcity, choice);
222}
223
224/**********************************************************************/
227static void twai_wonder_city_distance(struct player *pplayer, struct adv_data *adv)
228{
229 TAI_AIT;
230 TAI_DFUNC(dai_wonder_city_distance, pplayer, adv);
231}
232
233/**********************************************************************/
236static void twai_build_adv_init(struct player *pplayer)
237{
238 TAI_AIT;
240}
241
242/**********************************************************************/
245static void twai_build_adv_adjust(struct player *pplayer, struct city *wonder_city)
246{
247 TAI_AIT;
248 TAI_DFUNC(dai_build_adv_adjust, pplayer, wonder_city);
249}
250
251/**********************************************************************/
254static void twai_gov_value(struct player *pplayer, struct government *gov,
255 adv_want *val, bool *override)
256{
257 TAI_AIT;
258 TAI_DFUNC(dai_gov_value, pplayer, gov, val, override);
259}
260
261/**********************************************************************/
269
270/**********************************************************************/
278
279/**********************************************************************/
282static void twai_unit_alloc(struct unit *punit)
283{
284 TAI_AIT;
286}
287
288/**********************************************************************/
291static void twai_unit_free(struct unit *punit)
292{
293 TAI_AIT;
295}
296
297/**********************************************************************/
300static void twai_ferry_init_ferry(struct unit *ferry)
301{
302 TAI_AIT;
304}
305
306/**********************************************************************/
309static void twai_ferry_transformed(struct unit *ferry,
310 const struct unit_type *old)
311{
312 TAI_AIT;
313 TAI_DFUNC(dai_ferry_transformed, ferry, old);
314}
315
316/**********************************************************************/
319static void twai_ferry_lost(struct unit *punit)
320{
321 TAI_AIT;
323}
324
325/**********************************************************************/
328static void twai_unit_turn_end(struct unit *punit)
329{
330 TAI_AIT;
332}
333
334/**********************************************************************/
337static void twai_unit_move_or_attack(struct unit *punit, struct tile *ptile,
338 struct pf_path *path, int step)
339{
340 TAI_AIT;
342}
343
344/**********************************************************************/
347static void twai_unit_new_adv_task(struct unit *punit, enum adv_unit_task task,
348 struct tile *ptile)
349{
350 TAI_AIT;
352}
353
354/**********************************************************************/
357static void twai_unit_save(struct section_file *file, const struct unit *punit,
358 const char *unitstr)
359{
360 TAI_AIT;
361 TAI_DFUNC(dai_unit_save, "tai", file, punit, unitstr);
362}
363
364/**********************************************************************/
367static void twai_unit_load(const struct section_file *file, struct unit *punit,
368 const char *unitstr)
369{
370 TAI_AIT;
371 TAI_DFUNC(dai_unit_load, "tai", file, punit, unitstr);
372}
373
374/**********************************************************************/
377static void twai_auto_settler_reset(struct player *pplayer)
378{
379 TAI_AIT;
381}
382
383/**********************************************************************/
386static void twai_auto_settler_run(struct player *pplayer, struct unit *punit,
387 struct settlermap *state)
388{
389 TAI_AIT;
390 TAI_DFUNC(dai_auto_settler_run, &(wld.map), pplayer, punit, state);
391}
392
393/**********************************************************************/
396static void twai_auto_settler_cont(struct player *pplayer, struct unit *punit,
397 struct settlermap *state)
398{
399 TAI_AIT;
400 TAI_DFUNC(dai_auto_settler_cont, &(wld.map), pplayer, punit, state);
401}
402
403/**********************************************************************/
406static void twai_switch_to_explore(struct unit *punit, struct tile *target,
407 enum override_bool *allow)
408{
409 TAI_AIT;
410 TAI_DFUNC(dai_switch_to_explore, punit, target, allow);
411}
412
413/**********************************************************************/
416static void twai_first_activities(struct player *pplayer)
417{
418 TAI_AIT;
421}
422
423/**********************************************************************/
426static void twai_restart_phase(struct player *pplayer)
427{
428 TAI_AIT;
430}
431
432/**********************************************************************/
435static void twai_diplomacy_actions(struct player *pplayer)
436{
437 TAI_AIT;
439}
440
441/**********************************************************************/
444static void twai_last_activities(struct player *pplayer)
445{
446 TAI_AIT;
448}
449
450/**********************************************************************/
453static void twai_treaty_evaluate(struct player *pplayer, struct player *aplayer,
454 struct Treaty *ptreaty)
455{
456 TAI_AIT;
457 TAI_DFUNC(dai_treaty_evaluate, pplayer, aplayer, ptreaty);
458}
459
460/**********************************************************************/
463static void twai_treaty_accepted(struct player *pplayer, struct player *aplayer,
464 struct Treaty *ptreaty)
465{
466 TAI_AIT;
467 TAI_DFUNC(dai_treaty_accepted, pplayer, aplayer, ptreaty);
468}
469
470/**********************************************************************/
473static void twai_diplomacy_first_contact(struct player *pplayer,
474 struct player *aplayer)
475{
476 TAI_AIT;
477 TAI_DFUNC(dai_diplomacy_first_contact, pplayer, aplayer);
478}
479
480/**********************************************************************/
484 enum casus_belli_range scope,
485 const struct action *paction,
486 struct player *receiver,
487 struct player *violator, struct player *victim)
488{
489 TAI_AIT;
490 TAI_DFUNC(dai_incident, type, scope, paction, receiver, violator, victim);
491}
492
493/**********************************************************************/
496static void twai_city_log(char *buffer, int buflength, const struct city *pcity)
497{
498 TAI_AIT;
499 TAI_DFUNC(dai_city_log, buffer, buflength, pcity);
500}
501
502/**********************************************************************/
505static void twai_unit_log(char *buffer, int buflength, const struct unit *punit)
506{
507 TAI_AIT;
508 TAI_DFUNC(dai_unit_log, buffer, buflength, punit);
509}
510
511/**********************************************************************/
514static void twai_consider_plr_dangerous(struct player *plr1, struct player *plr2,
515 enum override_bool *result)
516{
517 TAI_AIT;
518 TAI_DFUNC(dai_consider_plr_dangerous, plr1, plr2, result);
519}
520
521/**********************************************************************/
524static void twai_consider_tile_dangerous(struct tile *ptile, struct unit *punit,
525 enum override_bool *result)
526{
527 TAI_AIT;
529}
530
531/**********************************************************************/
534static void twai_consider_wonder_city(struct city *pcity, bool *result)
535{
536 TAI_AIT;
537 TAI_DFUNC(dai_consider_wonder_city, pcity, result);
538}
539
540/**********************************************************************/
543static void twai_refresh(struct player *pplayer)
544{
545 TAI_AIT;
546 TAI_TFUNC(tai_refresh, pplayer);
547}
548
549/**********************************************************************/
552const char *fc_ai_threaded_capstr(void)
553{
554 return FC_AI_MOD_CAPSTR;
555}
556
557/**********************************************************************/
561{
562 struct dai_private_data *private;
563
564 if (!has_thread_cond_impl()) {
565 log_error(_("This Freeciv compilation has no full threads "
566 "implementation, threaded ai cannot be used."));
567 return FALSE;
568 }
569
570 strncpy(ai->name, "threaded", sizeof(ai->name));
571
572 private = fc_malloc(sizeof(struct dai_private_data));
573 private->contemplace_workers = TRUE;
574 ai->private = private;
575
576 tai_init_self(ai);
577
587
590
599
601
604
607
611
615
618
622
624
629
634
637
641
643
644 return TRUE;
645}
#define FC_AI_MOD_CAPSTR
Definition ai.h:27
incident_type
Definition ai.h:45
void dai_gov_value(struct ai_type *ait, struct player *pplayer, struct government *gov, adv_want *val, bool *override)
Definition aidata.c:524
void dai_data_phase_begin(struct ai_type *ait, struct player *pplayer, bool is_new_phase)
Definition aidata.c:142
void dai_data_phase_finished(struct ai_type *ait, struct player *pplayer)
Definition aidata.c:285
void dai_ferry_lost(struct ai_type *ait, struct unit *punit)
Definition aiferry.c:223
void dai_ferry_transformed(struct ai_type *ait, struct unit *ferry, const struct unit_type *old)
Definition aiferry.c:191
void dai_ferry_init_ferry(struct ai_type *ait, struct unit *ferry)
Definition aiferry.c:169
void dai_do_last_activities(struct ai_type *ait, struct player *pplayer)
Definition aihand.c:775
void dai_do_first_activities(struct ai_type *ait, struct player *pplayer)
Definition aihand.c:749
void dai_unit_log(struct ai_type *ait, char *buffer, int buflength, const struct unit *punit)
Definition ailog.c:53
void dai_city_log(struct ai_type *ait, char *buffer, int buflength, const struct city *pcity)
Definition ailog.c:40
void dai_player_save(struct ai_type *ait, const char *aitstr, struct player *pplayer, struct section_file *file, int plrno)
Definition aiplayer.c:64
void dai_player_copy(struct ai_type *ait, struct player *original, struct player *created)
Definition aiplayer.c:150
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
void dai_gained_control(struct ai_type *ait, struct player *pplayer)
Definition aiplayer.c:173
void dai_build_adv_override(struct ai_type *ait, struct city *pcity, struct adv_choice *choice)
Definition aitools.c:1351
void dai_consider_plr_dangerous(struct ai_type *ait, struct player *plr1, struct player *plr2, enum override_bool *result)
Definition aitools.c:142
void dai_unit_new_adv_task(struct ai_type *ait, struct unit *punit, enum adv_unit_task task, struct tile *ptile)
Definition aitools.c:620
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:1055
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
void dai_units_ruleset_init(struct ai_type *ait)
Definition aiunit.c:3200
void dai_switch_to_explore(struct ai_type *ait, struct unit *punit, struct tile *target, enum override_bool *allow)
Definition aiunit.c:3475
void dai_unit_turn_end(struct ai_type *ait, struct unit *punit)
Definition aiunit.c:3331
void dai_unit_init(struct ai_type *ait, struct unit *punit)
Definition aiunit.c:3309
void dai_consider_tile_dangerous(struct ai_type *ait, struct tile *ptile, struct unit *punit, enum override_bool *result)
Definition aiunit.c:3119
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
void dai_unit_close(struct ai_type *ait, struct unit *punit)
Definition aiunit.c:3343
void dai_units_ruleset_close(struct ai_type *ait)
Definition aiunit.c:3291
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:1140
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:1167
void dai_city_alloc(struct ai_type *ait, struct city *pcity)
Definition daicity.c:1113
void dai_consider_wonder_city(struct ai_type *ait, struct city *pcity, bool *result)
Definition daicity.c:2052
void dai_build_adv_adjust(struct ai_type *ait, struct player *pplayer, struct city *wonder_city)
Definition daicity.c:1937
void dai_city_free(struct ai_type *ait, struct city *pcity)
Definition daicity.c:1126
void dai_build_adv_init(struct ai_type *ait, struct player *pplayer)
Definition daicity.c:1921
void dai_treaty_accepted(struct ai_type *ait, struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
void dai_incident(struct ai_type *ait, enum incident_type type, enum casus_belli_range scope, const struct action *paction, struct player *receiver, struct player *violator, struct player *victim)
void dai_diplomacy_actions(struct ai_type *ait, struct player *pplayer)
void dai_treaty_evaluate(struct ai_type *ait, struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
void dai_diplomacy_first_contact(struct ai_type *ait, struct player *pplayer, struct player *aplayer)
void dai_wonder_city_distance(struct ai_type *ait, struct player *pplayer, struct adv_data *adv)
void dai_assess_danger_player(struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer)
void dai_auto_settler_cont(struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer, struct unit *punit, struct settlermap *state)
void dai_auto_settler_reset(struct ai_type *ait, struct player *pplayer)
void dai_auto_settler_run(struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer, struct unit *punit, struct settlermap *state)
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
float adv_want
Definition fc_types.h:1206
adv_unit_task
Definition fc_types.h:340
override_bool
Definition fc_types.h:84
#define _(String)
Definition fcintl.h:67
bool has_thread_cond_impl(void)
Definition fcthread.c:405
struct world wld
Definition game.c:58
GType type
Definition repodlgs.c:1312
#define log_error(message,...)
Definition log.h:103
#define FC_FREE(ptr)
Definition mem.h:41
#define fc_malloc(sz)
Definition mem.h:34
int step
Definition specpq.h:92
Definition ai.h:50
void(* log_fragment_unit)(char *buffer, int buflength, const struct unit *punit)
Definition ai.h:287
void(* city_alloc)(struct city *pcity)
Definition ai.h:128
void(* created_by_civil_war)(struct player *original, struct player *created)
Definition ai.h:117
void(* consider_tile_dangerous)(struct tile *ptile, struct unit *punit, enum override_bool *result)
Definition ai.h:294
void(* unit_lost)(struct unit *punit)
Definition ai.h:205
void(* treaty_evaluate)(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition ai.h:260
void(* gov_value)(struct player *pplayer, struct government *gov, adv_want *val, bool *override)
Definition ai.h:173
void(* treaty_accepted)(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition ai.h:265
void(* unit_transformed)(struct unit *punit, const struct unit_type *old_type)
Definition ai.h:202
void(* log_fragment_city)(char *buffer, int buflength, const struct city *pcity)
Definition ai.h:283
void(* settler_run)(struct player *pplayer, struct unit *punit, struct settlermap *state)
Definition ai.h:233
void(* unit_load)(const struct section_file *file, struct unit *punit, const char *unitstr)
Definition ai.h:226
void(* unit_move)(struct unit *punit, struct tile *ptile, struct pf_path *path, int step)
Definition ai.h:211
void(* unit_free)(struct unit *punit)
Definition ai.h:188
void(* phase_finished)(struct player *pplayer)
Definition ai.h:124
void(* restart_phase)(struct player *pplayer)
Definition ai.h:250
void(* settler_reset)(struct player *pplayer)
Definition ai.h:230
void(* unit_save)(struct section_file *file, const struct unit *punit, const char *unitstr)
Definition ai.h:222
void(* refresh)(struct player *pplayer)
Definition ai.h:302
void(* units_ruleset_close)(void)
Definition ai.h:180
void(* diplomacy_actions)(struct player *pplayer)
Definition ai.h:254
void(* player_alloc)(struct player *pplayer)
Definition ai.h:77
void(* build_adv_prepare)(struct player *pplayer, struct adv_data *adv)
Definition ai.h:161
void(* build_adv_adjust_want)(struct player *pplayer, struct city *wonder_city)
Definition ai.h:170
void(* player_load)(struct player *pplayer, const struct section_file *file, int plrno)
Definition ai.h:87
void(* build_adv_init)(struct player *pplayer)
Definition ai.h:165
void(* unit_task)(struct unit *punit, enum adv_unit_task task, struct tile *ptile)
Definition ai.h:218
void(* last_activities)(struct player *pplayer)
Definition ai.h:257
void(* incident)(enum incident_type type, enum casus_belli_range scope, const struct action *paction, struct player *receiver, struct player *violator, struct player *victim)
Definition ai.h:276
void(* settler_cont)(struct player *pplayer, struct unit *punit, struct settlermap *state)
Definition ai.h:238
void(* first_contact)(struct player *pplayer, struct player *aplayer)
Definition ai.h:272
void(* city_save)(struct section_file *file, const struct city *pcity, const char *citystr)
Definition ai.h:149
void(* consider_wonder_city)(struct city *pcity, bool *result)
Definition ai.h:299
void(* city_free)(struct city *pcity)
Definition ai.h:132
void(* choose_building)(struct city *pcity, struct adv_choice *choice)
Definition ai.h:158
struct ai_type::@14 funcs
void(* module_close)(void)
Definition ai.h:57
void(* city_load)(const struct section_file *file, struct city *pcity, const char *citystr)
Definition ai.h:153
void(* phase_begin)(struct player *pplayer, bool new_phase)
Definition ai.h:121
void(* player_free)(struct player *pplayer)
Definition ai.h:80
void(* split_by_civil_war)(struct player *original, struct player *created)
Definition ai.h:114
void(* unit_turn_end)(struct unit *punit)
Definition ai.h:208
void(* unit_alloc)(struct unit *punit)
Definition ai.h:184
void(* gained_control)(struct player *pplayer)
Definition ai.h:108
char name[MAX_LEN_NAME]
Definition ai.h:51
void(* unit_got)(struct unit *punit)
Definition ai.h:199
void * private
Definition ai.h:53
void(* player_save)(struct player *pplayer, struct section_file *file, int plrno)
Definition ai.h:83
void(* first_activities)(struct player *pplayer)
Definition ai.h:247
void(* consider_plr_dangerous)(struct player *plr1, struct player *plr2, enum override_bool *result)
Definition ai.h:290
void(* lost_control)(struct player *pplayer)
Definition ai.h:111
void(* units_ruleset_init)(void)
Definition ai.h:177
void(* want_to_explore)(struct unit *punit, struct tile *target, enum override_bool *allow)
Definition ai.h:242
Definition city.h:309
Definition tile.h:49
Definition unit.h:138
struct civ_map map
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
void tai_phase_finished(struct ai_type *ait, struct player *pplayer)
Definition taimsg.c:71
void tai_first_activities(struct ai_type *ait, struct player *pplayer)
Definition taimsg.c:63
void tai_control_gained(struct ai_type *ait, struct player *pplayer)
Definition taiplayer.c:196
void tai_control_lost(struct ai_type *ait, struct player *pplayer)
Definition taiplayer.c:217
void tai_player_alloc(struct ai_type *ait, struct player *pplayer)
Definition taiplayer.c:167
void tai_player_free(struct ai_type *ait, struct player *pplayer)
Definition taiplayer.c:180
void tai_init_threading(void)
Definition taiplayer.c:63
void tai_refresh(struct ai_type *ait, struct player *pplayer)
Definition taiplayer.c:239
static void twai_ferry_init_ferry(struct unit *ferry)
Definition threadedai.c:300
static void twai_consider_plr_dangerous(struct player *plr1, struct player *plr2, enum override_bool *result)
Definition threadedai.c:514
static void twai_refresh(struct player *pplayer)
Definition threadedai.c:543
static void twai_city_load(const struct section_file *file, struct city *pcity, const char *citystr)
Definition threadedai.c:208
static void twai_auto_settler_cont(struct player *pplayer, struct unit *punit, struct settlermap *state)
Definition threadedai.c:396
const char * fc_ai_threaded_capstr(void)
Definition threadedai.c:552
static void twai_incident(enum incident_type type, enum casus_belli_range scope, const struct action *paction, struct player *receiver, struct player *violator, struct player *victim)
Definition threadedai.c:483
static void twai_city_alloc(struct city *pcity)
Definition threadedai.c:180
static void twai_control_lost(struct player *pplayer)
Definition threadedai.c:132
static void twai_diplomacy_first_contact(struct player *pplayer, struct player *aplayer)
Definition threadedai.c:473
static void twai_city_log(char *buffer, int buflength, const struct city *pcity)
Definition threadedai.c:496
static void twai_control_gained(struct player *pplayer)
Definition threadedai.c:122
static void twai_treaty_evaluate(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition threadedai.c:453
static void twai_first_activities(struct player *pplayer)
Definition threadedai.c:416
bool fc_ai_threaded_setup(struct ai_type *ai)
Definition threadedai.c:560
static void twai_auto_settler_run(struct player *pplayer, struct unit *punit, struct settlermap *state)
Definition threadedai.c:386
static void tai_module_close(void)
Definition threadedai.c:71
static void twai_diplomacy_actions(struct player *pplayer)
Definition threadedai.c:435
static void twai_ferry_lost(struct unit *punit)
Definition threadedai.c:319
static void twai_player_alloc(struct player *pplayer)
Definition threadedai.c:81
static void twai_build_adv_override(struct city *pcity, struct adv_choice *choice)
Definition threadedai.c:218
static void twai_player_save(struct player *pplayer, struct section_file *file, int plrno)
Definition threadedai.c:101
static void twai_build_adv_init(struct player *pplayer)
Definition threadedai.c:236
static void twai_unit_move_or_attack(struct unit *punit, struct tile *ptile, struct pf_path *path, int step)
Definition threadedai.c:337
static void twai_phase_begin(struct player *pplayer, bool is_new_phase)
Definition threadedai.c:161
static void twai_consider_wonder_city(struct city *pcity, bool *result)
Definition threadedai.c:534
static void twai_player_free(struct player *pplayer)
Definition threadedai.c:91
static void twai_unit_save(struct section_file *file, const struct unit *punit, const char *unitstr)
Definition threadedai.c:357
static void twai_restart_phase(struct player *pplayer)
Definition threadedai.c:426
static void twai_phase_finished(struct player *pplayer)
Definition threadedai.c:170
static void twai_gov_value(struct player *pplayer, struct government *gov, adv_want *val, bool *override)
Definition threadedai.c:254
static void twai_units_ruleset_init(void)
Definition threadedai.c:264
static void twai_switch_to_explore(struct unit *punit, struct tile *target, enum override_bool *allow)
Definition threadedai.c:406
static void twai_unit_new_adv_task(struct unit *punit, enum adv_unit_task task, struct tile *ptile)
Definition threadedai.c:347
#define TAI_AIT
Definition threadedai.c:64
static void twai_created_by_civil_war(struct player *original, struct player *created)
Definition threadedai.c:151
#define TAI_TFUNC(_func,...)
Definition threadedai.c:65
static void twai_last_activities(struct player *pplayer)
Definition threadedai.c:444
static void twai_unit_load(const struct section_file *file, struct unit *punit, const char *unitstr)
Definition threadedai.c:367
static void twai_treaty_accepted(struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
Definition threadedai.c:463
static void twai_unit_log(char *buffer, int buflength, const struct unit *punit)
Definition threadedai.c:505
static struct ai_type * tai_get_self(void)
Definition threadedai.c:59
#define TAI_DFUNC(_func,...)
Definition threadedai.c:66
static struct ai_type * self
Definition threadedai.c:44
static void twai_unit_alloc(struct unit *punit)
Definition threadedai.c:282
static void twai_player_load(struct player *pplayer, const struct section_file *file, int plrno)
Definition threadedai.c:111
static void twai_units_ruleset_close(void)
Definition threadedai.c:273
static void twai_unit_turn_end(struct unit *punit)
Definition threadedai.c:328
static void twai_auto_settler_reset(struct player *pplayer)
Definition threadedai.c:377
static void twai_city_free(struct city *pcity)
Definition threadedai.c:189
static void twai_ferry_transformed(struct unit *ferry, const struct unit_type *old)
Definition threadedai.c:309
static void twai_split_by_civil_war(struct player *original, struct player *created)
Definition threadedai.c:141
static void twai_unit_free(struct unit *punit)
Definition threadedai.c:291
static void tai_init_self(struct ai_type *ai)
Definition threadedai.c:49
static void twai_consider_tile_dangerous(struct tile *ptile, struct unit *punit, enum override_bool *result)
Definition threadedai.c:524
static void twai_wonder_city_distance(struct player *pplayer, struct adv_data *adv)
Definition threadedai.c:227
static void twai_city_save(struct section_file *file, const struct city *pcity, const char *citystr)
Definition threadedai.c:198
static void twai_build_adv_adjust(struct player *pplayer, struct city *wonder_city)
Definition threadedai.c:245