Freeciv-3.2
Loading...
Searching...
No Matches
Functions
daidata.c File Reference
#include "game.h"
#include "government.h"
#include "map.h"
#include "multipliers.h"
#include "research.h"
#include "aiactions.h"
#include "cityturn.h"
#include "plrhand.h"
#include "advdata.h"
#include "aiferry.h"
#include "daicity.h"
#include "daidiplomacy.h"
#include "daieffects.h"
#include "daiplayer.h"
#include "daisettler.h"
#include "daiunit.h"
#include "daidata.h"

Go to the source code of this file.

Functions

static void dai_diplomacy_new (struct ai_type *ait, const struct player *plr1, const struct player *plr2)
 
static void dai_diplomacy_defaults (struct ai_type *ait, const struct player *plr1, const struct player *plr2)
 
static void dai_diplomacy_destroy (struct ai_type *ait, const struct player *plr1, const struct player *plr2)
 
void dai_data_init (struct ai_type *ait, struct player *pplayer)
 
void dai_data_close (struct ai_type *ait, struct player *pplayer)
 
bool is_ai_data_phase_open (struct ai_type *ait, struct player *pplayer)
 
void dai_data_phase_begin (struct ai_type *ait, struct player *pplayer, bool is_new_phase)
 
void dai_data_phase_finished (struct ai_type *ait, struct player *pplayer)
 
struct ai_plrdai_plr_data_get (struct ai_type *ait, struct player *pplayer, bool *caller_closes)
 
struct ai_dip_inteldai_diplomacy_get (struct ai_type *ait, const struct player *plr1, const struct player *plr2)
 
void dai_adjust_policies (struct ai_type *ait, struct player *pplayer)
 
void dai_gov_value (struct ai_type *ait, struct player *pplayer, struct government *gov, adv_want *val, bool *override)
 

Function Documentation

◆ dai_adjust_policies()

void dai_adjust_policies ( struct ai_type ait,
struct player pplayer 
)

Adjust multiplier values.

Definition at line 442 of file daidata.c.

Referenced by dai_do_last_activities().

◆ dai_data_close()

void dai_data_close ( struct ai_type ait,
struct player pplayer 
)

Deinitialize ai data structure

Definition at line 104 of file daidata.c.

Referenced by dai_player_free(), and texai_player_free().

◆ dai_data_init()

void dai_data_init ( struct ai_type ait,
struct player pplayer 
)

Initialize ai data structure

Definition at line 59 of file daidata.c.

Referenced by dai_player_alloc(), and texai_player_alloc().

◆ dai_data_phase_begin()

void dai_data_phase_begin ( struct ai_type ait,
struct player pplayer,
bool  is_new_phase 
)

Make and cache lots of calculations needed for other functions.

Definition at line 142 of file daidata.c.

Referenced by cai_data_phase_begin(), dai_plr_data_get(), and texwai_phase_begin().

◆ dai_data_phase_finished()

void dai_data_phase_finished ( struct ai_type ait,
struct player pplayer 
)

◆ dai_diplomacy_defaults()

static void dai_diplomacy_defaults ( struct ai_type ait,
const struct player plr1,
const struct player plr2 
)
static

Set diplomacy data between two players to its default values.

Definition at line 379 of file daidata.c.

Referenced by dai_data_init().

◆ dai_diplomacy_destroy()

static void dai_diplomacy_destroy ( struct ai_type ait,
const struct player plr1,
const struct player plr2 
)
static

Free resources allocated for diplomacy information between two players.

Definition at line 421 of file daidata.c.

Referenced by dai_data_close().

◆ dai_diplomacy_get()

struct ai_dip_intel * dai_diplomacy_get ( struct ai_type ait,
const struct player plr1,
const struct player plr2 
)

◆ dai_diplomacy_new()

static void dai_diplomacy_new ( struct ai_type ait,
const struct player plr1,
const struct player plr2 
)
static

Allocate new ai diplomacy slot

Definition at line 357 of file daidata.c.

Referenced by dai_data_init().

◆ dai_gov_value()

void dai_gov_value ( struct ai_type ait,
struct player pplayer,
struct government gov,
adv_want val,
bool override 
)

Set value of the government.

Definition at line 524 of file daidata.c.

Referenced by cai_gov_value(), and texwai_gov_value().

◆ dai_plr_data_get()

struct ai_plr * dai_plr_data_get ( struct ai_type ait,
struct player pplayer,
bool caller_closes 
)

Get current default ai data related to player. If close is set, data phase will be opened even if it's currently closed, and the boolean will be set accordingly to tell caller that phase needs closing.

Definition at line 308 of file daidata.c.

Referenced by contemplate_terrain_improvements(), dai_auto_settler_reset(), dai_diplomacy_actions(), dai_diplomacy_begin_new_phase(), dai_goldequiv_clause(), dai_player_copy(), dai_treaty_accepted(), dai_war_desire(), domestic_advisor_choose_build(), kill_something_with(), tdc_plr_get(), tdc_plr_set(), and texai_city_worker_wants().

◆ is_ai_data_phase_open()

bool is_ai_data_phase_open ( struct ai_type ait,
struct player pplayer 
)

Return whether data phase is currently open. Data phase is open between dai_data_phase_begin() and dai_data_phase_finished() calls.

Definition at line 132 of file daidata.c.