Freeciv-3.2
Loading...
Searching...
No Matches
Macros | Functions
diplhand.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include "bitvector.h"
#include "fcintl.h"
#include "log.h"
#include "mem.h"
#include "ai.h"
#include "diptreaty.h"
#include "events.h"
#include "game.h"
#include "map.h"
#include "packets.h"
#include "player.h"
#include "research.h"
#include "unit.h"
#include "luascript_types.h"
#include "citytools.h"
#include "cityturn.h"
#include "maphand.h"
#include "plrhand.h"
#include "notify.h"
#include "techtools.h"
#include "unittools.h"
#include "autosettlers.h"
#include "script_server.h"
#include "diplhand.h"

Go to the source code of this file.

Macros

#define TURNS_LEFT   16
 

Functions

static void call_treaty_evaluate (struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
 
static void call_treaty_accepted (struct player *pplayer, struct player *aplayer, struct Treaty *ptreaty)
 
static enum diplstate_type dst_closest (enum diplstate_type a, enum diplstate_type b)
 
enum diplstate_type valid_dst_closest (struct player_diplstate *dst)
 
void set_diplstate_type (struct player_diplstate *state1, struct player_diplstate *state2, enum diplstate_type type)
 
void handle_diplomacy_accept_treaty_req (struct player *pplayer, int counterpart)
 
void establish_embassy (struct player *pplayer, struct player *aplayer)
 
void handle_diplomacy_remove_clause_req (struct player *pplayer, int counterpart, int giver, enum clause_type type, int value)
 
void handle_diplomacy_create_clause_req (struct player *pplayer, int counterpart, int giver, enum clause_type type, int value)
 
static void really_diplomacy_cancel_meeting (struct player *pplayer, struct player *pother)
 
void handle_diplomacy_cancel_meeting_req (struct player *pplayer, int counterpart)
 
void handle_diplomacy_init_meeting_req (struct player *pplayer, int counterpart)
 
void send_diplomatic_meetings (struct connection *dest)
 
void cancel_all_meetings (struct player *pplayer)
 
void reject_all_treaties (struct player *pplayer)
 

Macro Definition Documentation

◆ TURNS_LEFT

#define TURNS_LEFT   16

Definition at line 60 of file diplhand.c.

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 76 of file diplhand.c.

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 65 of file diplhand.c.

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 926 of file diplhand.c.

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

◆ 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 87 of file diplhand.c.

Referenced by set_diplstate_type(), and valid_dst_closest().

◆ establish_embassy()

void establish_embassy ( struct player pplayer,
struct player aplayer 
)

Create an embassy. pplayer gets an embassy with aplayer.

Definition at line 701 of file diplhand.c.

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

◆ handle_diplomacy_accept_treaty_req()

void handle_diplomacy_accept_treaty_req ( struct player pplayer,
int  counterpart 
)

pplayer clicked the accept button. If they accepted the treaty we check the clauses. If both players have now accepted the treaty we execute the agreed clauses.

Definition at line 150 of file diplhand.c.

Referenced by dai_treaty_evaluate(), and server_handle_packet().

◆ handle_diplomacy_cancel_meeting_req()

void handle_diplomacy_cancel_meeting_req ( struct player pplayer,
int  counterpart 
)

Handle meeting cancelling request.

Definition at line 833 of file diplhand.c.

Referenced by server_handle_packet().

◆ 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 756 of file diplhand.c.

Referenced by dai_diplomacy_suggest(), and server_handle_packet().

◆ handle_diplomacy_init_meeting_req()

void handle_diplomacy_init_meeting_req ( struct player pplayer,
int  counterpart 
)

Handle meeting opening request.

Definition at line 848 of file diplhand.c.

Referenced by dai_diplomacy_suggest(), and server_handle_packet().

◆ 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 723 of file diplhand.c.

Referenced by server_handle_packet().

◆ 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 807 of file diplhand.c.

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 938 of file diplhand.c.

Referenced by handle_diplomacy_cancel_pact().

◆ 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 888 of file diplhand.c.

Referenced by begin_phase(), and connection_attach_real().

◆ set_diplstate_type()

void set_diplstate_type ( struct player_diplstate state1,
struct player_diplstate state2,
enum diplstate_type  type 
)

Set diplstate between two players.

Definition at line 125 of file diplhand.c.

Referenced by barbarian_initial_wars(), handle_diplomacy_accept_treaty_req(), make_contact(), split_player(), and srv_ready().

◆ valid_dst_closest()

enum diplstate_type valid_dst_closest ( struct player_diplstate dst)

Return closest diplstate dst has had, with extra sanity checking (i.e. may return state other than the recorder max_state)

Definition at line 111 of file diplhand.c.

Referenced by sg_load_player_main(), and sg_load_player_main().