Freeciv-3.1: /fast/freeciv/nightly/S3_1/server/diplhand.c File Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Macros | Functions | Variables
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)
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

## Macro Definition Documentation

## ◆ TURNS_LEFT

#define TURNS_LEFT 16

Definition at line 61 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 77 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 66 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 950 of file diplhand.c.

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

## ◆ diplhand_free()

void diplhand_free | ( | void |  | ) |

Free all the resources allocated by diplhand.

Definition at line 96 of file diplhand.c.

Referenced by server_quit().

## ◆ diplhand_init()

void diplhand_init | ( | void |  | ) |

Initialize diplhand module

Definition at line 88 of file diplhand.c.

Referenced by srv_prepare().

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

Referenced by set_diplstate_type().

## ◆ establish_embassy()

void establish_embassy | ( | struct player * | pplayer,
|  | struct player * | aplayer
| ) |  |

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_treaty()

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

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().

## ◆ free_treaties()

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().

## ◆ get_all_treaties()

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().

## ◆ 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 184 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 857 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 779 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 872 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 746 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 829 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 962 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 912 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 159 of file diplhand.c.

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

## Variable Documentation

## ◆ treaties

struct treaty_list* treaties = NULL

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().