Freeciv-3.2
Loading...
Searching...
No Matches
Functions | Variables
diptreaty.c File Reference
#include "log.h"
#include "mem.h"
#include "game.h"
#include "nation.h"
#include "player.h"
#include "diptreaty.h"

Go to the source code of this file.

Functions

bool diplomacy_possible (const struct player *pplayer1, const struct player *pplayer2)
 
bool could_meet_with_player (const struct player *pplayer, const struct player *aplayer)
 
bool could_intel_with_player (const struct player *pplayer, const struct player *aplayer)
 
void init_treaty (struct Treaty *ptreaty, struct player *plr0, struct player *plr1)
 
void clear_treaty (struct Treaty *ptreaty)
 
bool remove_clause (struct Treaty *ptreaty, struct player *pfrom, enum clause_type type, int val)
 
bool add_clause (struct Treaty *ptreaty, struct player *pfrom, enum clause_type type, int val, struct player *client_player)
 
void clause_infos_init (void)
 
void clause_infos_free (void)
 
struct clause_infoclause_info_get (enum clause_type type)
 
bool clause_enabled (enum clause_type type)
 
void treaties_init (void)
 
void treaties_free (void)
 
void free_treaties (void)
 
struct Treatyfind_treaty (struct player *plr0, struct player *plr1)
 
void treaty_add (struct Treaty *ptreaty)
 
void treaty_remove (struct Treaty *ptreaty)
 
void treaties_iterate (treaty_cb cb, void *data)
 

Variables

static struct clause_info clause_infos [CLAUSE_COUNT]
 
static struct treaty_list * treaties = NULL
 

Function Documentation

◆ add_clause()

bool add_clause ( struct Treaty ptreaty,
struct player pfrom,
enum clause_type  type,
int  val,
struct player client_player 
)

Add clause to treaty.

Definition at line 145 of file diptreaty.c.

Referenced by client_recv_create_clause(), handle_diplomacy_create_clause_req(), sg_load_treaties(), and sg_load_treaties().

◆ clause_enabled()

bool clause_enabled ( enum clause_type  type)

Is clause enabled in this game? This does not consider clause requirements that may change during the game, but returned value is constant for the given clause type thought the game.

Definition at line 289 of file diptreaty.c.

Referenced by add_clause(), create_clause_menu(), create_diplomacy_dialog(), diplo_wdg::diplo_wdg(), popup_add_menu(), popup_diplomatic_objects(), and diplo_wdg::show_menu().

◆ clause_info_get()

struct clause_info * clause_info_get ( enum clause_type  type)

Free memory associated with clause infos.

Definition at line 276 of file diptreaty.c.

Referenced by handle_diplomacy_accept_treaty_req(), handle_ruleset_clause(), is_universal_needed(), load_ruleset_game(), save_game_ruleset(), and send_ruleset_clauses().

◆ clause_infos_free()

void clause_infos_free ( void  )

Free memory associated with clause infos.

Definition at line 263 of file diptreaty.c.

Referenced by game_ruleset_free().

◆ clause_infos_init()

void clause_infos_init ( void  )

Initialize clause info structures.

Definition at line 248 of file diptreaty.c.

Referenced by game_ruleset_init().

◆ clear_treaty()

void clear_treaty ( struct Treaty ptreaty)

Free the clauses of a treaty.

Definition at line 112 of file diptreaty.c.

Referenced by free_treaties(), and treaty_remove().

◆ could_intel_with_player()

bool could_intel_with_player ( const struct player pplayer,
const struct player aplayer 
)

Returns TRUE iff pplayer can get intelligence about aplayer.

Definition at line 84 of file diptreaty.c.

Referenced by can_intel_with_player(), is_req_knowable(), plr_widget::nation_selected(), player_info_level(), and update_intel_dialog().

◆ could_meet_with_player()

bool could_meet_with_player ( const struct player pplayer,
const struct player aplayer 
)

Returns TRUE iff pplayer could do diplomatic meetings with aplayer.

Definition at line 64 of file diptreaty.c.

Referenced by can_meet_with_player(), dai_diplomacy_actions(), dai_diplomacy_first_contact(), dai_diplomacy_suggest(), and handle_diplomacy_init_meeting_req().

◆ diplomacy_possible()

bool diplomacy_possible ( const struct player pplayer1,
const struct player pplayer2 
)

Returns TRUE iff pplayer could do diplomacy in the game at all.

Definition at line 36 of file diptreaty.c.

Referenced by could_meet_with_player(), and dai_diplomacy_actions().

◆ find_treaty()

struct Treaty * find_treaty ( struct player plr0,
struct player plr1 
)

◆ free_treaties()

void free_treaties ( void  )

Free all the treaties currently in treaty list.

Definition at line 332 of file diptreaty.c.

Referenced by server_game_free(), and treaties_free().

◆ init_treaty()

void init_treaty ( struct Treaty ptreaty,
struct player plr0,
struct player plr1 
)

Initialize treaty structure between two players.

Definition at line 99 of file diptreaty.c.

Referenced by client_init_meeting(), handle_diplomacy_init_meeting_req(), sg_load_treaties(), and sg_load_treaties().

◆ remove_clause()

bool remove_clause ( struct Treaty ptreaty,
struct player pfrom,
enum clause_type  type,
int  val 
)

Remove clause from treaty

Definition at line 123 of file diptreaty.c.

Referenced by client_recv_remove_clause(), and handle_diplomacy_remove_clause_req().

◆ treaties_free()

void treaties_free ( void  )

Free all the resources allocated by treaties.

Definition at line 321 of file diptreaty.c.

Referenced by game_free().

◆ treaties_init()

void treaties_init ( void  )

Initialize treaties module

Definition at line 313 of file diptreaty.c.

Referenced by game_init().

◆ treaties_iterate()

void treaties_iterate ( treaty_cb  cb,
void data 
)

Call callback for each treaty

Definition at line 380 of file diptreaty.c.

Referenced by sg_save_treaties().

◆ treaty_add()

void treaty_add ( struct Treaty ptreaty)

Add treaty to the global list.

Definition at line 361 of file diptreaty.c.

Referenced by client_init_meeting(), handle_diplomacy_init_meeting_req(), sg_load_treaties(), and sg_load_treaties().

◆ treaty_remove()

void treaty_remove ( struct Treaty ptreaty)

Remove treaty from the global list.

Definition at line 369 of file diptreaty.c.

Referenced by client_recv_cancel_meeting(), handle_diplomacy_accept_treaty_req(), and really_diplomacy_cancel_meeting().

Variable Documentation

◆ clause_infos

struct clause_info clause_infos[CLAUSE_COUNT]
static

◆ treaties

struct treaty_list* treaties = NULL
static