Freeciv-3.3
Loading...
Searching...
No Matches
Macros | Functions | Variables
texai.c File Reference
#include "ai.h"
#include "world_object.h"
#include "aiferry.h"
#include "aihand.h"
#include "daicity.h"
#include "daidiplomacy.h"
#include "daidomestic.h"
#include "dailog.h"
#include "daimilitary.h"
#include "daiplayer.h"
#include "daisettler.h"
#include "daitools.h"
#include "daiunit.h"
#include "texaicity.h"
#include "texaimsg.h"
#include "texaiplayer.h"
#include "texaiworld.h"

Go to the source code of this file.

Macros

#define TEXAI_AIT   struct ai_type *ait = texai_get_self();
 
#define TEXAI_TFUNC(_func, ...)   _func(ait, ## __VA_ARGS__ );
 
#define TEXAI_DFUNC(_func, ...)   _func(ait, ## __VA_ARGS__ );
 

Functions

const charfc_ai_tex_capstr (void)
 
bool fc_ai_tex_setup (struct ai_type *ai)
 
static void texai_init_self (struct ai_type *ai)
 
struct ai_typetexai_get_self (void)
 
static void texai_module_close (void)
 
static void texwai_player_alloc (struct player *pplayer)
 
static void texwai_player_free (struct player *pplayer)
 
static void texwai_player_save (struct player *pplayer, struct section_file *file, int plrno)
 
static void texwai_player_load (struct player *pplayer, const struct section_file *file, int plrno)
 
static void texwai_control_gained (struct player *pplayer)
 
static void texwai_control_lost (struct player *pplayer)
 
static void texwai_split_by_civil_war (struct player *original, struct player *created)
 
static void texwai_created_by_civil_war (struct player *original, struct player *created)
 
static void texwai_phase_begin (struct player *pplayer, bool is_new_phase)
 
static void texwai_phase_finished (struct player *pplayer)
 
static void texwai_city_alloc (struct city *pcity)
 
static void texwai_city_free (struct city *pcity)
 
static void texwai_city_save (struct section_file *file, const struct city *pcity, const char *citystr)
 
static void texwai_city_load (const struct section_file *file, struct city *pcity, const char *citystr)
 
static void texwai_build_adv_override (struct city *pcity, struct adv_choice *choice)
 
static void texwai_wonder_city_distance (struct player *pplayer, struct adv_data *adv)
 
static void texwai_build_adv_init (struct player *pplayer)
 
static void texwai_build_adv_adjust (struct player *pplayer, struct city *wonder_city)
 
static void texwai_gov_value (struct player *pplayer, struct government *gov, adv_want *val, bool *override)
 
static void texwai_units_ruleset_init (void)
 
static void texwai_units_ruleset_close (void)
 
static void texwai_unit_alloc (struct unit *punit)
 
static void texwai_unit_free (struct unit *punit)
 
static void texwai_ferry_init_ferry (struct unit *ferry)
 
static void texwai_ferry_transformed (struct unit *ferry, const struct unit_type *old)
 
static void texwai_ferry_lost (struct unit *punit)
 
static void texwai_unit_turn_end (struct unit *punit)
 
static void texwai_unit_move_or_attack (struct unit *punit, struct tile *ptile, struct pf_path *path, int step)
 
static void texwai_unit_new_adv_task (struct unit *punit, enum adv_unit_task task, struct tile *ptile)
 
static void texwai_unit_save (struct section_file *file, const struct unit *punit, const char *unitstr)
 
static void texwai_unit_load (const struct section_file *file, struct unit *punit, const char *unitstr)
 
static void texwai_auto_settler_reset (struct player *pplayer)
 
static void texwai_auto_settler_run (struct player *pplayer, struct unit *punit, struct workermap *state)
 
static void texwai_auto_settler_cont (struct player *pplayer, struct unit *punit, struct workermap *state)
 
static void texwai_switch_to_explore (struct unit *punit, struct tile *target, enum override_bool *allow)
 
static void texwai_first_activities (struct player *pplayer)
 
static void texwai_restart_phase (struct player *pplayer)
 
static void texwai_diplomacy_actions (struct player *pplayer)
 
static void texwai_last_activities (struct player *pplayer)
 
static void texwai_treaty_evaluate (struct player *pplayer, struct player *aplayer, struct treaty *ptreaty)
 
static void texwai_treaty_accepted (struct player *pplayer, struct player *aplayer, struct treaty *ptreaty)
 
static void texwai_diplomacy_first_contact (struct player *pplayer, struct player *aplayer)
 
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)
 
static void texwai_city_log (char *buffer, int buflength, const struct city *pcity)
 
static void texwai_unit_log (char *buffer, int buflength, const struct unit *punit)
 
static void texwai_consider_plr_dangerous (struct player *plr1, struct player *plr2, enum override_bool *result)
 
static void texwai_consider_tile_dangerous (struct tile *ptile, struct unit *punit, enum override_bool *result)
 
static void texwai_consider_wonder_city (struct city *pcity, bool *result)
 
static void texwai_refresh (struct player *pplayer)
 
static void texwai_revolution_start (struct player *pplayer)
 

Variables

static struct ai_typeself = NULL
 

Macro Definition Documentation

◆ TEXAI_AIT

#define TEXAI_AIT   struct ai_type *ait = texai_get_self();

Definition at line 66 of file texai.c.

◆ TEXAI_DFUNC

#define TEXAI_DFUNC (   _func,
  ... 
)    _func(ait, ## __VA_ARGS__ );

Definition at line 68 of file texai.c.

◆ TEXAI_TFUNC

#define TEXAI_TFUNC (   _func,
  ... 
)    _func(ait, ## __VA_ARGS__ );

Definition at line 67 of file texai.c.

Function Documentation

◆ fc_ai_tex_capstr()

const char * fc_ai_tex_capstr ( void  )

Return module capability string

Definition at line 581 of file texai.c.

◆ fc_ai_tex_setup()

bool fc_ai_tex_setup ( struct ai_type ai)

Setup player ai_funcs function pointers.

Definition at line 589 of file texai.c.

Referenced by ai_init().

◆ texai_get_self()

struct ai_type * texai_get_self ( void  )

Get pointer to ai type of the tex ai.

Definition at line 61 of file texai.c.

Referenced by texai_city_destruction_recv(), texai_city_info_recv(), texai_player_units(), texai_unit_destruction_recv(), and texai_unit_info_recv().

◆ texai_init_self()

static void texai_init_self ( struct ai_type ai)
static

Set pointer to ai type of the tex ai.

Definition at line 51 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texai_module_close()

static void texai_module_close ( void  )
static

Free resources allocated by the tex AI module

Definition at line 73 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_auto_settler_cont()

static void texwai_auto_settler_cont ( struct player pplayer,
struct unit punit,
struct workermap state 
)
static

Call default ai with tex ai type as parameter.

Definition at line 406 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_auto_settler_reset()

static void texwai_auto_settler_reset ( struct player pplayer)
static

Call default ai with tex ai type as parameter.

Definition at line 384 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_auto_settler_run()

static void texwai_auto_settler_run ( struct player pplayer,
struct unit punit,
struct workermap state 
)
static

Call default ai with tex ai type as parameter.

Definition at line 393 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_build_adv_adjust()

static void texwai_build_adv_adjust ( struct player pplayer,
struct city wonder_city 
)
static

Call default ai with tex ai type as parameter.

Definition at line 249 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_build_adv_init()

static void texwai_build_adv_init ( struct player pplayer)
static

Call default ai with tex ai type as parameter.

Definition at line 240 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_build_adv_override()

static void texwai_build_adv_override ( struct city pcity,
struct adv_choice choice 
)
static

Call default ai with tex ai type as parameter.

Definition at line 220 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_city_alloc()

static void texwai_city_alloc ( struct city pcity)
static

Call default ai with tex ai type as parameter.

Definition at line 182 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_city_free()

static void texwai_city_free ( struct city pcity)
static

Call default ai with tex ai type as parameter.

Definition at line 191 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_city_load()

static void texwai_city_load ( const struct section_file file,
struct city pcity,
const char citystr 
)
static

Call default ai with tex ai type as parameter.

Definition at line 210 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_city_log()

static void texwai_city_log ( char buffer,
int  buflength,
const struct city pcity 
)
static

Call default ai with tex ai type as parameter.

Definition at line 512 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_city_save()

static void texwai_city_save ( struct section_file file,
const struct city pcity,
const char citystr 
)
static

Call default ai with tex ai type as parameter.

Definition at line 200 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_consider_plr_dangerous()

static void texwai_consider_plr_dangerous ( struct player plr1,
struct player plr2,
enum override_bool result 
)
static

Call default ai with tex ai type as parameter.

Definition at line 532 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_consider_tile_dangerous()

static void texwai_consider_tile_dangerous ( struct tile ptile,
struct unit punit,
enum override_bool result 
)
static

Call default ai with tex ai type as parameter.

Definition at line 543 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_consider_wonder_city()

static void texwai_consider_wonder_city ( struct city pcity,
bool result 
)
static

Call default ai with tex ai type as parameter.

Definition at line 554 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_control_gained()

static void texwai_control_gained ( struct player pplayer)
static

Call default ai with tex ai type as parameter.

Definition at line 124 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_control_lost()

static void texwai_control_lost ( struct player pplayer)
static

Call default ai with tex ai type as parameter.

Definition at line 134 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_created_by_civil_war()

static void texwai_created_by_civil_war ( struct player original,
struct player created 
)
static

Call default ai with tex ai type as parameter.

Definition at line 153 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_diplomacy_actions()

static void texwai_diplomacy_actions ( struct player pplayer)
static

Call default ai with tex ai type as parameter.

Definition at line 448 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_diplomacy_first_contact()

static void texwai_diplomacy_first_contact ( struct player pplayer,
struct player aplayer 
)
static

Call default ai with tex ai type as parameter.

Definition at line 488 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_ferry_init_ferry()

static void texwai_ferry_init_ferry ( struct unit ferry)
static

Call default ai with tex ai type as parameter.

Definition at line 305 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_ferry_lost()

static void texwai_ferry_lost ( struct unit punit)
static

Call default ai with tex ai type as parameter.

Definition at line 324 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_ferry_transformed()

static void texwai_ferry_transformed ( struct unit ferry,
const struct unit_type old 
)
static

Call default ai with tex ai type as parameter.

Definition at line 314 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_first_activities()

static void texwai_first_activities ( struct player pplayer)
static

Call default ai with tex ai type as parameter.

Definition at line 429 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_gov_value()

static void texwai_gov_value ( struct player pplayer,
struct government gov,
adv_want val,
bool override 
)
static

Call default ai with tex ai type as parameter.

Definition at line 259 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ 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 
)
static

Call default ai with tex ai type as parameter.

Definition at line 498 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_last_activities()

static void texwai_last_activities ( struct player pplayer)
static

Call default ai with tex ai type as parameter.

Definition at line 457 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_phase_begin()

static void texwai_phase_begin ( struct player pplayer,
bool  is_new_phase 
)
static

Call default ai with tex ai type as parameter.

Definition at line 163 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_phase_finished()

static void texwai_phase_finished ( struct player pplayer)
static

Call default ai with tex ai type as parameter.

Definition at line 172 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_player_alloc()

static void texwai_player_alloc ( struct player pplayer)
static

Call default ai with tex ai type as parameter.

Definition at line 83 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_player_free()

static void texwai_player_free ( struct player pplayer)
static

Call default ai with tex ai type as parameter.

Definition at line 93 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_player_load()

static void texwai_player_load ( struct player pplayer,
const struct section_file file,
int  plrno 
)
static

Call default ai with tex ai type as parameter.

Definition at line 113 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_player_save()

static void texwai_player_save ( struct player pplayer,
struct section_file file,
int  plrno 
)
static

Call default ai with tex ai type as parameter.

Definition at line 103 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_refresh()

static void texwai_refresh ( struct player pplayer)
static

Call default ai with tex ai type as parameter.

Definition at line 563 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_restart_phase()

static void texwai_restart_phase ( struct player pplayer)
static

Start working on the thread again.

Definition at line 439 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_revolution_start()

static void texwai_revolution_start ( struct player pplayer)
static

Call default ai with tex ai type as parameter.

Definition at line 572 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_split_by_civil_war()

static void texwai_split_by_civil_war ( struct player original,
struct player created 
)
static

Call default ai with tex ai type as parameter.

Definition at line 143 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_switch_to_explore()

static void texwai_switch_to_explore ( struct unit punit,
struct tile target,
enum override_bool allow 
)
static

Call default ai with tex ai type as parameter.

Definition at line 419 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_treaty_accepted()

static void texwai_treaty_accepted ( struct player pplayer,
struct player aplayer,
struct treaty ptreaty 
)
static

Call default ai with tex ai type as parameter.

Definition at line 477 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_treaty_evaluate()

static void texwai_treaty_evaluate ( struct player pplayer,
struct player aplayer,
struct treaty ptreaty 
)
static

Call default ai with tex ai type as parameter.

Definition at line 466 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_unit_alloc()

static void texwai_unit_alloc ( struct unit punit)
static

Call default ai with tex ai type as parameter.

Definition at line 287 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_unit_free()

static void texwai_unit_free ( struct unit punit)
static

Call default ai with tex ai type as parameter.

Definition at line 296 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_unit_load()

static void texwai_unit_load ( const struct section_file file,
struct unit punit,
const char unitstr 
)
static

Call default ai with tex ai type as parameter.

Definition at line 374 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_unit_log()

static void texwai_unit_log ( char buffer,
int  buflength,
const struct unit punit 
)
static

Call default ai with tex ai type as parameter.

Definition at line 522 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_unit_move_or_attack()

static void texwai_unit_move_or_attack ( struct unit punit,
struct tile ptile,
struct pf_path path,
int  step 
)
static

Call default ai with tex ai type as parameter.

Definition at line 342 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_unit_new_adv_task()

static void texwai_unit_new_adv_task ( struct unit punit,
enum adv_unit_task  task,
struct tile ptile 
)
static

Call default ai with tex ai type as parameter.

Definition at line 353 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_unit_save()

static void texwai_unit_save ( struct section_file file,
const struct unit punit,
const char unitstr 
)
static

Call default ai with tex ai type as parameter.

Definition at line 364 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_unit_turn_end()

static void texwai_unit_turn_end ( struct unit punit)
static

Call default ai with tex ai type as parameter.

Definition at line 333 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_units_ruleset_close()

static void texwai_units_ruleset_close ( void  )
static

Call default ai with tex ai type as parameter.

Definition at line 278 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_units_ruleset_init()

static void texwai_units_ruleset_init ( void  )
static

Call default ai with tex ai type as parameter.

Definition at line 269 of file texai.c.

Referenced by fc_ai_tex_setup().

◆ texwai_wonder_city_distance()

static void texwai_wonder_city_distance ( struct player pplayer,
struct adv_data adv 
)
static

Call default ai with tex ai type as parameter.

Definition at line 230 of file texai.c.

Referenced by fc_ai_tex_setup().

Variable Documentation

◆ self

struct ai_type* self = NULL
static

Definition at line 46 of file texai.c.

Referenced by texai_get_self(), and texai_init_self().