Freeciv-3.1
|
#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) |
void | diplhand_init (void) |
void | diplhand_free (void) |
void | free_treaties (void) |
struct Treaty * | find_treaty (struct player *plr0, struct player *plr1) |
static enum diplstate_type | dst_closest (enum diplstate_type a, enum diplstate_type b) |
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) |
struct treaty_list * | get_all_treaties (void) |
Variables | |
static struct treaty_list * | treaties = NULL |
#define TURNS_LEFT 16 |
Definition at line 61 of file diplhand.c.
|
static |
Calls treaty_accepted function if such is set for AI player.
Definition at line 77 of file diplhand.c.
Referenced by handle_diplomacy_accept_treaty_req().
|
static |
Calls treaty_evaluate function if such is set for AI player.
Definition at line 66 of file diplhand.c.
Referenced by handle_diplomacy_create_clause_req(), and handle_diplomacy_remove_clause_req().
void cancel_all_meetings | ( | struct player * | pplayer | ) |
Cancels all meetings of player.
Definition at line 950 of file diplhand.c.
Referenced by kill_player(), player_set_to_ai_mode(), and player_set_under_human_control().
void diplhand_free | ( | void | ) |
Free all the resources allocated by diplhand.
Definition at line 96 of file diplhand.c.
Referenced by server_quit().
void diplhand_init | ( | void | ) |
|
static |
Return the closest of the two diplstate types.
Definition at line 136 of file diplhand.c.
Referenced by set_diplstate_type().
Create an embassy. pplayer gets an embassy with aplayer.
Definition at line 724 of file diplhand.c.
Referenced by diplomat_embassy(), handle_diplomacy_accept_treaty_req(), and split_player().
Find currently active treaty between two players.
Definition at line 121 of file diplhand.c.
Referenced by cancel_all_meetings(), clear_old_treaty(), handle_diplomacy_accept_treaty_req(), handle_diplomacy_create_clause_req(), handle_diplomacy_init_meeting_req(), handle_diplomacy_remove_clause_req(), really_diplomacy_cancel_meeting(), reject_all_treaties(), and send_diplomatic_meetings().
void free_treaties | ( | void | ) |
Free all the treaties currently in treaty list.
Definition at line 107 of file diplhand.c.
Referenced by diplhand_free(), and server_game_free().
struct treaty_list * get_all_treaties | ( | void | ) |
Get treaty list
Definition at line 986 of file diplhand.c.
Referenced by sg_load_treaties(), sg_load_treaties(), and sg_save_treaties().
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 184 of file diplhand.c.
Referenced by dai_treaty_evaluate(), and server_handle_packet().
void handle_diplomacy_cancel_meeting_req | ( | struct player * | pplayer, |
int | counterpart | ||
) |
Handle meeting cancelling request.
Definition at line 857 of file diplhand.c.
Referenced by server_handle_packet().
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 779 of file diplhand.c.
Referenced by dai_diplomacy_suggest(), and server_handle_packet().
void handle_diplomacy_init_meeting_req | ( | struct player * | pplayer, |
int | counterpart | ||
) |
Handle meeting opening request.
Definition at line 872 of file diplhand.c.
Referenced by dai_diplomacy_suggest(), and server_handle_packet().
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 746 of file diplhand.c.
Referenced by server_handle_packet().
|
static |
Cancel meeting. No sanity checking of input parameters, so don't call this with input directly from untrusted source.
Definition at line 829 of file diplhand.c.
Referenced by cancel_all_meetings(), and handle_diplomacy_cancel_meeting_req().
void reject_all_treaties | ( | struct player * | pplayer | ) |
Reject all treaties currently being negotiated
Definition at line 962 of file diplhand.c.
Referenced by handle_diplomacy_cancel_pact().
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 912 of file diplhand.c.
Referenced by begin_phase(), and connection_attach_real().
void set_diplstate_type | ( | struct player_diplstate * | state1, |
struct player_diplstate * | state2, | ||
enum diplstate_type | type | ||
) |
Set diplstate between two players.
Definition at line 159 of file diplhand.c.
Referenced by barbarian_initial_wars(), handle_diplomacy_accept_treaty_req(), make_contact(), split_player(), and srv_ready().
|
static |
Definition at line 58 of file diplhand.c.
Referenced by diplhand_free(), diplhand_init(), find_treaty(), free_treaties(), get_all_treaties(), handle_diplomacy_accept_treaty_req(), handle_diplomacy_init_meeting_req(), really_diplomacy_cancel_meeting(), sg_load_treaties(), sg_load_treaties(), and sg_save_treaties().