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

Freeciv-3.1

Loading...
Searching...
No Matches
Macros | Functions | Variables
texai.c File Reference
`#include "ai.h"`
`#include "aidata.h"`
`#include "aiferry.h"`
`#include "aihand.h"`
`#include "ailog.h"`
`#include "aiplayer.h"`
`#include "aitools.h"`
`#include "daicity.h"`
`#include "daidiplomacy.h"`
`#include "daidomestic.h"`
`#include "daimilitary.h"`
`#include "daisettler.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 char * | fc_ai_tex_capstr (void)
bool | fc_ai_tex_setup (struct ai_type *ai)
static void | texai_init_self (struct ai_type *ai)
struct ai_type * | texai_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 settlermap *state)
static void | texwai_auto_settler_cont (struct player *pplayer, struct unit *punit, struct settlermap *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)

## Variables

static struct ai_type * | self = NULL

## Macro Definition Documentation

## ◆ TEXAI_AIT

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

Definition at line 65 of file texai.c.

## ◆ TEXAI_DFUNC

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

Definition at line 67 of file texai.c.

## ◆ TEXAI_TFUNC

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

Definition at line 66 of file texai.c.

## Function Documentation

## ◆ fc_ai_tex_capstr()

const char * fc_ai_tex_capstr | ( | void |  | ) |

Return module capability string

Definition at line 571 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 579 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 60 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 50 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 72 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 settlermap * | state
| ) |  |

static

Call default ai with tex ai type as parameter.

Definition at line 405 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 383 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 settlermap * | state
| ) |  |

static

Call default ai with tex ai type as parameter.

Definition at line 392 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 248 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 239 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 219 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 181 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 190 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 209 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 511 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 199 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 531 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 542 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 553 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 123 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 133 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 152 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 447 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 487 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 304 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 323 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 313 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 428 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 258 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 497 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 456 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 162 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 171 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 82 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 92 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 112 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 102 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 562 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 438 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 142 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 418 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 476 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 465 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 286 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 295 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 373 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 521 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 341 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 352 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 363 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 332 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 277 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 268 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 229 of file texai.c.

Referenced by fc_ai_tex_setup().

## Variable Documentation

## ◆ self

struct ai_type* self = NULL

static

Definition at line 45 of file texai.c.

Referenced by texai_get_self(), and texai_init_self().