Freeciv21
Develop your civilization from humble roots to a global empire
diplhand.cpp File Reference
#include "bitvector.h"
#include "fcintl.h"
#include "log.h"
#include "ai.h"
#include "diptreaty.h"
#include "events.h"
#include "game.h"
#include "packets.h"
#include "player.h"
#include "research.h"
#include "luascript_types.h"
#include "citytools.h"
#include "cityturn.h"
#include "maphand.h"
#include "notify.h"
#include "plrhand.h"
#include "techtools.h"
#include "unittools.h"
#include "script_server.h"
#include "diplhand.h"
+ Include dependency graph for diplhand.cpp:

Go to the source code of this file.

Functions

static void call_treaty_evaluate (struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
 Calls treaty_evaluate function if such is set for AI player. More...
 
static void call_treaty_accepted (struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
 Calls treaty_accepted function if such is set for AI player. More...
 
void diplhand_init ()
 Initialize diplhand module. More...
 
void diplhand_free ()
 Free all the resources allocated by diplhand. More...
 
void free_treaties ()
 Free all the treaties currently in treaty list. More...
 
struct Treatyfind_treaty (struct player *plr0, struct player *plr1)
 Find currently active treaty between two players. More...
 
static enum diplstate_type dst_closest (enum diplstate_type a, enum diplstate_type b)
 Return the closest of the two diplstate types. More...
 
void handle_diplomacy_accept_treaty_req (struct player *pplayer, int counterpart)
 pplayer clicked the accept button. More...
 
void establish_embassy (struct player *pplayer, struct player *aplayer)
 Create an embassy. More...
 
void handle_diplomacy_remove_clause_req (struct player *pplayer, int counterpart, int giver, enum clause_type type, int value)
 Handle request to remove clause from treaty. More...
 
void handle_diplomacy_create_clause_req (struct player *pplayer, int counterpart, int giver, enum clause_type type, int value)
 Handle request to add clause to treaty between two players. More...
 
static void really_diplomacy_cancel_meeting (struct player *pplayer, struct player *pother)
 Cancel meeting. More...
 
void handle_diplomacy_cancel_meeting_req (struct player *pplayer, int counterpart)
 Handle meeting cancelling request. More...
 
void handle_diplomacy_init_meeting_req (struct player *pplayer, int counterpart)
 Handle meeting opening request. More...
 
void send_diplomatic_meetings (struct connection *dest)
 Send information on any on-going diplomatic meetings for connection's player. More...
 
void cancel_all_meetings (struct player *pplayer)
 Cancels all meetings of player. More...
 
void reject_all_treaties (struct player *pplayer)
 Reject all treaties currently being negotiated. More...
 
struct treaty_list * get_all_treaties ()
 Get treaty list. More...
 

Variables

static struct treaty_list * treaties = nullptr
 

Function Documentation

◆ call_treaty_accepted()

static void call_treaty_accepted ( struct player pplayer,
struct player aplayer,
struct Treaty ptreaty 
)
static

Calls treaty_accepted function if such is set for AI player.

Definition at line 61 of file diplhand.cpp.

Referenced by handle_diplomacy_accept_treaty_req().

◆ call_treaty_evaluate()

static void call_treaty_evaluate ( struct player pplayer,
struct player aplayer,
struct Treaty ptreaty 
)
static

Calls treaty_evaluate function if such is set for AI player.

Definition at line 49 of file diplhand.cpp.

Referenced by handle_diplomacy_create_clause_req(), and handle_diplomacy_remove_clause_req().

◆ cancel_all_meetings()

void cancel_all_meetings ( struct player pplayer)

Cancels all meetings of player.

Definition at line 897 of file diplhand.cpp.

Referenced by kill_player(), player_set_to_ai_mode(), and player_set_under_human_control().

◆ diplhand_free()

void diplhand_free ( )

Free all the resources allocated by diplhand.

Definition at line 78 of file diplhand.cpp.

Referenced by server_quit().

◆ diplhand_init()

void diplhand_init ( )

Initialize diplhand module.

Definition at line 73 of file diplhand.cpp.

◆ dst_closest()

static enum diplstate_type dst_closest ( enum diplstate_type  a,
enum diplstate_type  b 
)
static

Return the closest of the two diplstate types.

Definition at line 105 of file diplhand.cpp.

Referenced by handle_diplomacy_accept_treaty_req().

◆ establish_embassy()

void establish_embassy ( struct player pplayer,
struct player aplayer 
)

Create an embassy.

pplayer gets an embassy with aplayer.

Definition at line 689 of file diplhand.cpp.

Referenced by diplomat_embassy(), handle_diplomacy_accept_treaty_req(), and split_player().

◆ find_treaty()

◆ free_treaties()

void free_treaties ( )

Free all the treaties currently in treaty list.

Definition at line 89 of file diplhand.cpp.

Referenced by diplhand_free(), and server_game_free().

◆ get_all_treaties()

struct treaty_list* get_all_treaties ( )

Get treaty list.

Definition at line 933 of file diplhand.cpp.

Referenced by sg_load_treaties(), and sg_save_treaties().

◆ handle_diplomacy_accept_treaty_req()

void handle_diplomacy_accept_treaty_req ( struct player pplayer,
int  counterpart 
)

pplayer clicked the accept button.

If he accepted the treaty we check the clauses. If both players have now accepted the treaty we execute the agreed clauses.

Definition at line 146 of file diplhand.cpp.

Referenced by dai_treaty_evaluate().

◆ handle_diplomacy_cancel_meeting_req()

void handle_diplomacy_cancel_meeting_req ( struct player pplayer,
int  counterpart 
)

Handle meeting cancelling request.

Definition at line 808 of file diplhand.cpp.

◆ handle_diplomacy_create_clause_req()

void handle_diplomacy_create_clause_req ( struct player pplayer,
int  counterpart,
int  giver,
enum clause_type  type,
int  value 
)

Handle request to add clause to treaty between two players.

Definition at line 736 of file diplhand.cpp.

Referenced by dai_diplomacy_suggest().

◆ handle_diplomacy_init_meeting_req()

void handle_diplomacy_init_meeting_req ( struct player pplayer,
int  counterpart 
)

Handle meeting opening request.

Definition at line 823 of file diplhand.cpp.

Referenced by dai_diplomacy_suggest().

◆ handle_diplomacy_remove_clause_req()

void handle_diplomacy_remove_clause_req ( struct player pplayer,
int  counterpart,
int  giver,
enum clause_type  type,
int  value 
)

Handle request to remove clause from treaty.

Definition at line 705 of file diplhand.cpp.

◆ really_diplomacy_cancel_meeting()

static void really_diplomacy_cancel_meeting ( struct player pplayer,
struct player pother 
)
static

Cancel meeting.

No sanity checking of input parameters, so don't call this with input directly from untrusted source.

Definition at line 784 of file diplhand.cpp.

Referenced by cancel_all_meetings(), and handle_diplomacy_cancel_meeting_req().

◆ reject_all_treaties()

void reject_all_treaties ( struct player pplayer)

Reject all treaties currently being negotiated.

Definition at line 911 of file diplhand.cpp.

Referenced by handle_diplomacy_cancel_pact_explicit().

◆ send_diplomatic_meetings()

void send_diplomatic_meetings ( struct connection dest)

Send information on any on-going diplomatic meetings for connection's player.

For re-connections.

Definition at line 859 of file diplhand.cpp.

Referenced by begin_phase(), and connection_attach_real().

Variable Documentation

◆ treaties