Freeciv-3.1
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
diptreaty.h File Reference
#include "requirements.h"
#include "support.h"
#include "specenum_gen.h"
#include "speclist.h"

Go to the source code of this file.

Data Structures

struct  clause_info
 
struct  Clause
 
struct  Treaty
 

Macros

#define SPECENUM_NAME   clause_type
 
#define SPECENUM_VALUE0   CLAUSE_ADVANCE
 
#define SPECENUM_VALUE0NAME   "Advance"
 
#define SPECENUM_VALUE1   CLAUSE_GOLD
 
#define SPECENUM_VALUE1NAME   "Gold"
 
#define SPECENUM_VALUE2   CLAUSE_MAP
 
#define SPECENUM_VALUE2NAME   "Map"
 
#define SPECENUM_VALUE3   CLAUSE_SEAMAP
 
#define SPECENUM_VALUE3NAME   "Seamap"
 
#define SPECENUM_VALUE4   CLAUSE_CITY
 
#define SPECENUM_VALUE4NAME   "City"
 
#define SPECENUM_VALUE5   CLAUSE_CEASEFIRE
 
#define SPECENUM_VALUE5NAME   "Ceasefire"
 
#define SPECENUM_VALUE6   CLAUSE_PEACE
 
#define SPECENUM_VALUE6NAME   "Peace"
 
#define SPECENUM_VALUE7   CLAUSE_ALLIANCE
 
#define SPECENUM_VALUE7NAME   "Alliance"
 
#define SPECENUM_VALUE8   CLAUSE_VISION
 
#define SPECENUM_VALUE8NAME   "Vision"
 
#define SPECENUM_VALUE9   CLAUSE_EMBASSY
 
#define SPECENUM_VALUE9NAME   "Embassy"
 
#define SPECENUM_COUNT   CLAUSE_COUNT
 
#define is_pact_clause(x)    ((x == CLAUSE_CEASEFIRE) || (x == CLAUSE_PEACE) || (x == CLAUSE_ALLIANCE))
 
#define SPECLIST_TAG   clause
 
#define SPECLIST_TYPE   struct Clause
 
#define clause_list_iterate(clauselist, pclause)    TYPED_LIST_ITERATE(struct Clause, clauselist, pclause)
 
#define clause_list_iterate_end   LIST_ITERATE_END
 

Functions

bool diplomacy_possible (const struct player *pplayer, const struct player *aplayer)
 
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)
 
bool add_clause (struct Treaty *ptreaty, struct player *pfrom, enum clause_type type, int val, struct player *client_player)
 
bool remove_clause (struct Treaty *ptreaty, struct player *pfrom, enum clause_type type, int val)
 
void clear_treaty (struct Treaty *ptreaty)
 
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)
 

Macro Definition Documentation

◆ clause_list_iterate

#define clause_list_iterate (   clauselist,
  pclause 
)     TYPED_LIST_ITERATE(struct Clause, clauselist, pclause)

Definition at line 66 of file diptreaty.h.

◆ clause_list_iterate_end

#define clause_list_iterate_end   LIST_ITERATE_END

Definition at line 68 of file diptreaty.h.

◆ is_pact_clause

#define is_pact_clause (   x)     ((x == CLAUSE_CEASEFIRE) || (x == CLAUSE_PEACE) || (x == CLAUSE_ALLIANCE))

Definition at line 49 of file diptreaty.h.

◆ SPECENUM_COUNT

#define SPECENUM_COUNT   CLAUSE_COUNT

Definition at line 46 of file diptreaty.h.

◆ SPECENUM_NAME

#define SPECENUM_NAME   clause_type

Definition at line 25 of file diptreaty.h.

◆ SPECENUM_VALUE0

#define SPECENUM_VALUE0   CLAUSE_ADVANCE

Definition at line 26 of file diptreaty.h.

◆ SPECENUM_VALUE0NAME

#define SPECENUM_VALUE0NAME   "Advance"

Definition at line 27 of file diptreaty.h.

◆ SPECENUM_VALUE1

#define SPECENUM_VALUE1   CLAUSE_GOLD

Definition at line 28 of file diptreaty.h.

◆ SPECENUM_VALUE1NAME

#define SPECENUM_VALUE1NAME   "Gold"

Definition at line 29 of file diptreaty.h.

◆ SPECENUM_VALUE2

#define SPECENUM_VALUE2   CLAUSE_MAP

Definition at line 30 of file diptreaty.h.

◆ SPECENUM_VALUE2NAME

#define SPECENUM_VALUE2NAME   "Map"

Definition at line 31 of file diptreaty.h.

◆ SPECENUM_VALUE3

#define SPECENUM_VALUE3   CLAUSE_SEAMAP

Definition at line 32 of file diptreaty.h.

◆ SPECENUM_VALUE3NAME

#define SPECENUM_VALUE3NAME   "Seamap"

Definition at line 33 of file diptreaty.h.

◆ SPECENUM_VALUE4

#define SPECENUM_VALUE4   CLAUSE_CITY

Definition at line 34 of file diptreaty.h.

◆ SPECENUM_VALUE4NAME

#define SPECENUM_VALUE4NAME   "City"

Definition at line 35 of file diptreaty.h.

◆ SPECENUM_VALUE5

#define SPECENUM_VALUE5   CLAUSE_CEASEFIRE

Definition at line 36 of file diptreaty.h.

◆ SPECENUM_VALUE5NAME

#define SPECENUM_VALUE5NAME   "Ceasefire"

Definition at line 37 of file diptreaty.h.

◆ SPECENUM_VALUE6

#define SPECENUM_VALUE6   CLAUSE_PEACE

Definition at line 38 of file diptreaty.h.

◆ SPECENUM_VALUE6NAME

#define SPECENUM_VALUE6NAME   "Peace"

Definition at line 39 of file diptreaty.h.

◆ SPECENUM_VALUE7

#define SPECENUM_VALUE7   CLAUSE_ALLIANCE

Definition at line 40 of file diptreaty.h.

◆ SPECENUM_VALUE7NAME

#define SPECENUM_VALUE7NAME   "Alliance"

Definition at line 41 of file diptreaty.h.

◆ SPECENUM_VALUE8

#define SPECENUM_VALUE8   CLAUSE_VISION

Definition at line 42 of file diptreaty.h.

◆ SPECENUM_VALUE8NAME

#define SPECENUM_VALUE8NAME   "Vision"

Definition at line 43 of file diptreaty.h.

◆ SPECENUM_VALUE9

#define SPECENUM_VALUE9   CLAUSE_EMBASSY

Definition at line 44 of file diptreaty.h.

◆ SPECENUM_VALUE9NAME

#define SPECENUM_VALUE9NAME   "Embassy"

Definition at line 45 of file diptreaty.h.

◆ SPECLIST_TAG

#define SPECLIST_TAG   clause

Definition at line 62 of file diptreaty.h.

◆ SPECLIST_TYPE

#define SPECLIST_TYPE   struct Clause

Definition at line 63 of file diptreaty.h.

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 142 of file diptreaty.c.

Referenced by handle_diplomacy_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 286 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)

◆ clause_infos_free()

void clause_infos_free ( void  )

Free memory associated with clause infos.

Definition at line 260 of file diptreaty.c.

Referenced by game_ruleset_free().

◆ clause_infos_init()

void clause_infos_init ( void  )

Initialize clause info structures.

Definition at line 245 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 109 of file diptreaty.c.

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

◆ 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 81 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 61 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 33 of file diptreaty.c.

Referenced by could_meet_with_player(), and dai_diplomacy_actions().

◆ init_treaty()

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

Initialize treaty structure between two players.

Definition at line 96 of file diptreaty.c.

Referenced by create_diplomacy_dialog(), diplo_wdg::diplo_wdg(), 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 120 of file diptreaty.c.

Referenced by handle_diplomacy_remove_clause(), and handle_diplomacy_remove_clause_req().