Feature #825 ยป 0019-Rename-struct-Treaty-as-struct-treaty.patch
ai/classic/classicai.c | ||
---|---|---|
Call default ai with classic ai type as parameter.
|
||
**************************************************************************/
|
||
static void cai_treaty_evaluate(struct player *pplayer, struct player *aplayer,
|
||
struct Treaty *ptreaty)
|
||
struct treaty *ptreaty)
|
||
{
|
||
struct ai_type *deftype = classic_ai_get_self();
|
||
... | ... | |
Call default ai with classic ai type as parameter.
|
||
**************************************************************************/
|
||
static void cai_treaty_accepted(struct player *pplayer, struct player *aplayer,
|
||
struct Treaty *ptreaty)
|
||
struct treaty *ptreaty)
|
||
{
|
||
struct ai_type *deftype = classic_ai_get_self();
|
||
ai/default/daidiplomacy.c | ||
---|---|---|
is the treaty being considered. It is all a question about money :-)
|
||
**********************************************************************/
|
||
void dai_treaty_evaluate(struct ai_type *ait, struct player *pplayer,
|
||
struct player *aplayer, struct Treaty *ptreaty)
|
||
struct player *aplayer, struct treaty *ptreaty)
|
||
{
|
||
int total_balance = 0;
|
||
bool only_gifts = TRUE;
|
||
... | ... | |
is the treaty accepted.
|
||
**********************************************************************/
|
||
void dai_treaty_accepted(struct ai_type *ait, struct player *pplayer,
|
||
struct player *aplayer, struct Treaty *ptreaty)
|
||
struct player *aplayer, struct treaty *ptreaty)
|
||
{
|
||
bool close_here;
|
||
struct ai_plr *ai;
|
||
... | ... | |
**********************************************************************/
|
||
static void clear_old_treaty(struct player *pplayer, struct player *aplayer)
|
||
{
|
||
struct Treaty *old_treaty = find_treaty(pplayer, aplayer);
|
||
struct treaty *old_treaty = find_treaty(pplayer, aplayer);
|
||
if (old_treaty != NULL) {
|
||
/* Remove existing clauses */
|
ai/default/daidiplomacy.h | ||
---|---|---|
#include "ai.h" /* incident_type */
|
||
struct Treaty;
|
||
struct treaty;
|
||
struct Clause;
|
||
struct ai_data;
|
||
... | ... | |
void dai_diplomacy_actions(struct ai_type *ait, struct player *pplayer);
|
||
void dai_treaty_evaluate(struct ai_type *ait, struct player *pplayer,
|
||
struct player *aplayer, struct Treaty *ptreaty);
|
||
struct player *aplayer, struct treaty *ptreaty);
|
||
void dai_treaty_accepted(struct ai_type *ait, struct player *pplayer,
|
||
struct player *aplayer, struct Treaty *ptreaty);
|
||
struct player *aplayer, struct treaty *ptreaty);
|
||
void dai_incident(struct ai_type *ait, enum incident_type type,
|
||
enum casus_belli_range scope,
|
ai/tex/texai.c | ||
---|---|---|
**************************************************************************/
|
||
static void texwai_treaty_evaluate(struct player *pplayer,
|
||
struct player *aplayer,
|
||
struct Treaty *ptreaty)
|
||
struct treaty *ptreaty)
|
||
{
|
||
TEXAI_AIT;
|
||
TEXAI_DFUNC(dai_treaty_evaluate, pplayer, aplayer, ptreaty);
|
||
... | ... | |
**************************************************************************/
|
||
static void texwai_treaty_accepted(struct player *pplayer,
|
||
struct player *aplayer,
|
||
struct Treaty *ptreaty)
|
||
struct treaty *ptreaty)
|
||
{
|
||
TEXAI_AIT;
|
||
TEXAI_DFUNC(dai_treaty_accepted, pplayer, aplayer, ptreaty);
|
client/clitreaty.c | ||
---|---|---|
**************************************************************************/
|
||
void client_init_meeting(int counterpart, int initiated_from)
|
||
{
|
||
struct Treaty *ptreaty;
|
||
struct treaty *ptreaty;
|
||
struct player *we;
|
||
struct player *they;
|
||
... | ... | |
void client_recv_accept_treaty(int counterpart, bool I_accepted,
|
||
bool other_accepted)
|
||
{
|
||
struct Treaty *ptreaty;
|
||
struct treaty *ptreaty;
|
||
struct player *we;
|
||
struct player *they;
|
||
... | ... | |
**************************************************************************/
|
||
void client_recv_cancel_meeting(int counterpart, int initiated_from)
|
||
{
|
||
struct Treaty *ptreaty;
|
||
struct treaty *ptreaty;
|
||
struct player *we;
|
||
struct player *they;
|
||
... | ... | |
void client_recv_create_clause(int counterpart, int giver,
|
||
enum clause_type type, int value)
|
||
{
|
||
struct Treaty *ptreaty;
|
||
struct treaty *ptreaty;
|
||
struct player *we;
|
||
struct player *they;
|
||
... | ... | |
void client_recv_remove_clause(int counterpart, int giver,
|
||
enum clause_type type, int value)
|
||
{
|
||
struct Treaty *ptreaty;
|
||
struct treaty *ptreaty;
|
||
struct player *we;
|
||
struct player *they;
|
||
client/gui-gtk-3.22/diplodlg.c | ||
---|---|---|
#include "plrdlg.h"
|
||
struct Diplomacy_dialog {
|
||
struct Treaty *treaty;
|
||
struct treaty *treaty;
|
||
struct gui_dialog *dialog;
|
||
GtkWidget *menu0;
|
||
... | ... | |
static struct dialog_list *dialog_list;
|
||
static struct Diplomacy_notebook *dipl_main;
|
||
static struct Diplomacy_dialog *create_diplomacy_dialog(struct Treaty *ptreaty,
|
||
static struct Diplomacy_dialog *create_diplomacy_dialog(struct treaty *ptreaty,
|
||
struct player *plr0,
|
||
struct player *plr1);
|
||
static struct Diplomacy_dialog *find_diplomacy_dialog(struct player *they);
|
||
static void popup_diplomacy_dialog(struct Treaty *ptreaty, struct player *they,
|
||
static void popup_diplomacy_dialog(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator);
|
||
static void diplomacy_dialog_map_callback(GtkWidget *w, gpointer data);
|
||
static void diplomacy_dialog_seamap_callback(GtkWidget *w, gpointer data);
|
||
... | ... | |
/************************************************************************//**
|
||
Server tells us that either party has accepted treaty
|
||
****************************************************************************/
|
||
void gui_recv_accept_treaty(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_accept_treaty(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct Diplomacy_dialog *pdialog = find_diplomacy_dialog(they);
|
||
... | ... | |
/************************************************************************//**
|
||
Someone is initiating meeting with us.
|
||
****************************************************************************/
|
||
void gui_init_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void gui_init_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
popup_diplomacy_dialog(ptreaty, they, initiator);
|
||
... | ... | |
/************************************************************************//**
|
||
Meeting has been cancelled.
|
||
****************************************************************************/
|
||
void gui_recv_cancel_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void gui_recv_cancel_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
struct Diplomacy_dialog *pdialog = find_diplomacy_dialog(they);
|
||
... | ... | |
/**********************************************************************//**
|
||
Prepare to clause creation or removal.
|
||
**************************************************************************/
|
||
void gui_prepare_clause_updt(struct Treaty *ptreaty, struct player *they)
|
||
void gui_prepare_clause_updt(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
/* Not needed */
|
||
}
|
||
... | ... | |
/************************************************************************//**
|
||
Added clause to the meeting
|
||
****************************************************************************/
|
||
void gui_recv_create_clause(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_create_clause(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct Diplomacy_dialog *pdialog = find_diplomacy_dialog(they);
|
||
... | ... | |
/************************************************************************//**
|
||
Removed clause from meeting.
|
||
****************************************************************************/
|
||
void gui_recv_remove_clause(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_remove_clause(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct Diplomacy_dialog *pdialog = find_diplomacy_dialog(they);
|
||
... | ... | |
/************************************************************************//**
|
||
Popup the dialog 10% inside the main-window
|
||
****************************************************************************/
|
||
static void popup_diplomacy_dialog(struct Treaty *ptreaty, struct player *they,
|
||
static void popup_diplomacy_dialog(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
struct Diplomacy_dialog *pdialog = find_diplomacy_dialog(they);
|
||
... | ... | |
/************************************************************************//**
|
||
Setups diplomacy dialog widgets.
|
||
****************************************************************************/
|
||
static struct Diplomacy_dialog *create_diplomacy_dialog(struct Treaty *ptreaty,
|
||
static struct Diplomacy_dialog *create_diplomacy_dialog(struct treaty *ptreaty,
|
||
struct player *plr0,
|
||
struct player *plr1)
|
||
{
|
client/gui-gtk-4.0/diplodlg.c | ||
---|---|---|
#include "plrdlg.h"
|
||
struct Diplomacy_dialog {
|
||
struct Treaty *treaty;
|
||
struct treaty *treaty;
|
||
struct gui_dialog *dialog;
|
||
GtkWidget *pic0;
|
||
... | ... | |
static struct dialog_list *dialog_list;
|
||
static struct Diplomacy_notebook *dipl_main;
|
||
static struct Diplomacy_dialog *create_diplomacy_dialog(struct Treaty *ptreaty,
|
||
static struct Diplomacy_dialog *create_diplomacy_dialog(struct treaty *ptreaty,
|
||
struct player *plr0,
|
||
struct player *plr1);
|
||
static struct Diplomacy_dialog *find_diplomacy_dialog(struct player *they);
|
||
static void popup_diplomacy_dialog(struct Treaty *ptreaty, struct player *they,
|
||
static void popup_diplomacy_dialog(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator);
|
||
static void diplomacy_dialog_map_callback(GSimpleAction *action,
|
||
GVariant *parameter,
|
||
... | ... | |
/************************************************************************//**
|
||
Server tells us that either party has accepted treaty
|
||
****************************************************************************/
|
||
void gui_recv_accept_treaty(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_accept_treaty(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct Diplomacy_dialog *pdialog = find_diplomacy_dialog(they);
|
||
... | ... | |
/************************************************************************//**
|
||
Someone is initiating meeting with us.
|
||
****************************************************************************/
|
||
void gui_init_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void gui_init_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
popup_diplomacy_dialog(ptreaty, they, initiator);
|
||
... | ... | |
/************************************************************************//**
|
||
Meeting has been cancelled.
|
||
****************************************************************************/
|
||
void gui_recv_cancel_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void gui_recv_cancel_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
struct Diplomacy_dialog *pdialog = find_diplomacy_dialog(they);
|
||
... | ... | |
/**********************************************************************//**
|
||
Prepare to clause creation or removal.
|
||
**************************************************************************/
|
||
void gui_prepare_clause_updt(struct Treaty *ptreaty, struct player *they)
|
||
void gui_prepare_clause_updt(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
/* Not needed */
|
||
}
|
||
... | ... | |
/************************************************************************//**
|
||
Added clause to the meeting
|
||
****************************************************************************/
|
||
void gui_recv_create_clause(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_create_clause(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct Diplomacy_dialog *pdialog = find_diplomacy_dialog(they);
|
||
... | ... | |
/************************************************************************//**
|
||
Removed clause from meeting.
|
||
****************************************************************************/
|
||
void gui_recv_remove_clause(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_remove_clause(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct Diplomacy_dialog *pdialog = find_diplomacy_dialog(they);
|
||
... | ... | |
/************************************************************************//**
|
||
Popup the dialog 10% inside the main-window
|
||
****************************************************************************/
|
||
static void popup_diplomacy_dialog(struct Treaty *ptreaty, struct player *they,
|
||
static void popup_diplomacy_dialog(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
struct Diplomacy_dialog *pdialog = find_diplomacy_dialog(they);
|
||
... | ... | |
/************************************************************************//**
|
||
Setups diplomacy dialog widgets.
|
||
****************************************************************************/
|
||
static struct Diplomacy_dialog *create_diplomacy_dialog(struct Treaty *ptreaty,
|
||
static struct Diplomacy_dialog *create_diplomacy_dialog(struct treaty *ptreaty,
|
||
struct player *plr0,
|
||
struct player *plr1)
|
||
{
|
client/gui-gtk-5.0/diplodlg.c | ||
---|---|---|
#include "plrdlg.h"
|
||
struct Diplomacy_dialog {
|
||
struct Treaty *treaty;
|
||
struct treaty *treaty;
|
||
struct gui_dialog *dialog;
|
||
GtkWidget *pic0;
|
||
... | ... | |
static struct dialog_list *dialog_list;
|
||
static struct Diplomacy_notebook *dipl_main;
|
||
static struct Diplomacy_dialog *create_diplomacy_dialog(struct Treaty *ptreaty,
|
||
static struct Diplomacy_dialog *create_diplomacy_dialog(struct treaty *ptreaty,
|
||
struct player *plr0,
|
||
struct player *plr1);
|
||
static struct Diplomacy_dialog *find_diplomacy_dialog(struct player *they);
|
||
static void popup_diplomacy_dialog(struct Treaty *ptreaty, struct player *they,
|
||
static void popup_diplomacy_dialog(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator);
|
||
static void diplomacy_dialog_map_callback(GSimpleAction *action,
|
||
GVariant *parameter,
|
||
... | ... | |
/************************************************************************//**
|
||
Server tells us that either party has accepted treaty
|
||
****************************************************************************/
|
||
void gui_recv_accept_treaty(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_accept_treaty(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct Diplomacy_dialog *pdialog = find_diplomacy_dialog(they);
|
||
... | ... | |
/************************************************************************//**
|
||
Someone is initiating meeting with us.
|
||
****************************************************************************/
|
||
void gui_init_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void gui_init_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
popup_diplomacy_dialog(ptreaty, they, initiator);
|
||
... | ... | |
/************************************************************************//**
|
||
Meeting has been cancelled.
|
||
****************************************************************************/
|
||
void gui_recv_cancel_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void gui_recv_cancel_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
struct Diplomacy_dialog *pdialog = find_diplomacy_dialog(they);
|
||
... | ... | |
/**********************************************************************//**
|
||
Prepare to clause creation or removal.
|
||
**************************************************************************/
|
||
void gui_prepare_clause_updt(struct Treaty *ptreaty, struct player *they)
|
||
void gui_prepare_clause_updt(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
/* Not needed */
|
||
}
|
||
... | ... | |
/************************************************************************//**
|
||
Added clause to the meeting
|
||
****************************************************************************/
|
||
void gui_recv_create_clause(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_create_clause(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct Diplomacy_dialog *pdialog = find_diplomacy_dialog(they);
|
||
... | ... | |
/************************************************************************//**
|
||
Removed clause from meeting.
|
||
****************************************************************************/
|
||
void gui_recv_remove_clause(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_remove_clause(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct Diplomacy_dialog *pdialog = find_diplomacy_dialog(they);
|
||
... | ... | |
/************************************************************************//**
|
||
Popup the dialog 10% inside the main-window
|
||
****************************************************************************/
|
||
static void popup_diplomacy_dialog(struct Treaty *ptreaty, struct player *they,
|
||
static void popup_diplomacy_dialog(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
struct Diplomacy_dialog *pdialog = find_diplomacy_dialog(they);
|
||
... | ... | |
/************************************************************************//**
|
||
Setups diplomacy dialog widgets.
|
||
****************************************************************************/
|
||
static struct Diplomacy_dialog *create_diplomacy_dialog(struct Treaty *ptreaty,
|
||
static struct Diplomacy_dialog *create_diplomacy_dialog(struct treaty *ptreaty,
|
||
struct player *plr0,
|
||
struct player *plr1)
|
||
{
|
client/gui-qt/diplodlg.cpp | ||
---|---|---|
/************************************************************************//**
|
||
Constructor for diplomacy widget
|
||
****************************************************************************/
|
||
diplo_wdg::diplo_wdg(struct Treaty *ptreaty,
|
||
diplo_wdg::diplo_wdg(struct treaty *ptreaty,
|
||
struct player *they, struct player *initiator): QWidget()
|
||
{
|
||
struct player *we;
|
||
... | ... | |
/************************************************************************//**
|
||
Constructor for diplomacy dialog
|
||
****************************************************************************/
|
||
diplo_dlg::diplo_dlg(struct Treaty *ptreaty, struct player *they,
|
||
diplo_dlg::diplo_dlg(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator) : QTabWidget()
|
||
{
|
||
add_widget(ptreaty, they, initiator);
|
||
... | ... | |
/************************************************************************//**
|
||
Creates new diplomacy widget and adds to diplomacy dialog
|
||
****************************************************************************/
|
||
void diplo_dlg::add_widget(struct Treaty *ptreaty, struct player *they,
|
||
void diplo_dlg::add_widget(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
diplo_wdg *dw;
|
||
... | ... | |
Update a player's acceptance status of a treaty (traditionally shown
|
||
with the thumbs-up/thumbs-down sprite).
|
||
****************************************************************************/
|
||
void qtg_recv_accept_treaty(struct Treaty *ptreaty, struct player *they)
|
||
void qtg_recv_accept_treaty(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
int i;
|
||
diplo_dlg *dd;
|
||
... | ... | |
Handle the start of a diplomacy meeting - usually by popping up a
|
||
diplomacy dialog.
|
||
****************************************************************************/
|
||
void qtg_init_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void qtg_init_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
int i;
|
||
... | ... | |
/**********************************************************************//**
|
||
Prepare to clause creation or removal.
|
||
**************************************************************************/
|
||
void qtg_prepare_clause_updt(struct Treaty *ptreaty, struct player *they)
|
||
void qtg_prepare_clause_updt(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
// Not needed
|
||
}
|
||
... | ... | |
/************************************************************************//**
|
||
Update the diplomacy dialog by adding a clause.
|
||
****************************************************************************/
|
||
void qtg_recv_create_clause(struct Treaty *ptreaty, struct player *they)
|
||
void qtg_recv_create_clause(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
int i;
|
||
diplo_dlg *dd;
|
||
... | ... | |
Update the diplomacy dialog when the meeting is canceled (the dialog
|
||
should be closed).
|
||
****************************************************************************/
|
||
void qtg_recv_cancel_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void qtg_recv_cancel_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
int i;
|
||
... | ... | |
/************************************************************************//**
|
||
Update the diplomacy dialog by removing a clause.
|
||
****************************************************************************/
|
||
void qtg_recv_remove_clause(struct Treaty *ptreaty, struct player *they)
|
||
void qtg_recv_remove_clause(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
int i;
|
||
diplo_dlg *dd;
|
client/gui-qt/diplodlg.h | ||
---|---|---|
QTableWidget *text_edit;
|
||
public:
|
||
diplo_wdg(struct Treaty *ptreaty,
|
||
diplo_wdg(struct treaty *ptreaty,
|
||
struct player *they, struct player *initiator);
|
||
~diplo_wdg();
|
||
void update_wdg();
|
||
void set_index(int ind);
|
||
int get_index();
|
||
struct Treaty *treaty;
|
||
struct treaty *treaty;
|
||
private slots:
|
||
void all_advances();
|
||
... | ... | |
QMap<struct player *, diplo_wdg *> treaty_list;
|
||
public:
|
||
diplo_dlg(struct Treaty *ptreaty, struct player *they,
|
||
diplo_dlg(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator);
|
||
~diplo_dlg();
|
||
void reactivate();
|
||
... | ... | |
bool init(bool raise);
|
||
diplo_wdg *find_widget(struct player *they);
|
||
void close_widget(struct player *they);
|
||
void add_widget(struct Treaty *ptreaty, struct player *they,
|
||
void add_widget(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator);
|
||
void make_active(struct player *party);
|
||
client/gui-qt/qtg_cxxside.h | ||
---|---|---|
char **qtg_get_gui_specific_themes_directories(int *count);
|
||
char **qtg_get_usable_themes_in_directory(const char *directory, int *count);
|
||
void qtg_init_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void qtg_init_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator);
|
||
void qtg_recv_cancel_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void qtg_recv_cancel_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator);
|
||
void qtg_prepare_clause_updt(struct Treaty *ptreaty, struct player *they);
|
||
void qtg_recv_create_clause(struct Treaty *ptreaty, struct player *they);
|
||
void qtg_recv_remove_clause(struct Treaty *ptreaty, struct player *they);
|
||
void qtg_recv_accept_treaty(struct Treaty *ptreaty, struct player *they);
|
||
void qtg_prepare_clause_updt(struct treaty *ptreaty, struct player *they);
|
||
void qtg_recv_create_clause(struct treaty *ptreaty, struct player *they);
|
||
void qtg_recv_remove_clause(struct treaty *ptreaty, struct player *they);
|
||
void qtg_recv_accept_treaty(struct treaty *ptreaty, struct player *they);
|
||
void qtg_request_action_confirmation(const char *expl,
|
||
struct act_confirmation_data *data);
|
client/gui-sdl2/diplodlg.c | ||
---|---|---|
#include "diplodlg.h"
|
||
struct diplomacy_dialog {
|
||
struct Treaty *treaty;
|
||
struct treaty *treaty;
|
||
struct advanced_dialog *pdialog;
|
||
struct advanced_dialog *pwants;
|
||
struct advanced_dialog *poffers;
|
||
... | ... | |
Update a player's acceptance status of a treaty (traditionally shown
|
||
with the thumbs-up/thumbs-down sprite).
|
||
**************************************************************************/
|
||
void gui_recv_accept_treaty(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_accept_treaty(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct diplomacy_dialog *pdialog = get_diplomacy_dialog(they);
|
||
... | ... | |
Update the diplomacy dialog when the meeting is canceled (the dialog
|
||
should be closed).
|
||
**************************************************************************/
|
||
void gui_recv_cancel_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void gui_recv_cancel_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
struct diplomacy_dialog *pdialog = get_diplomacy_dialog(they);
|
||
... | ... | |
/**********************************************************************//**
|
||
Prepare to clause creation or removal.
|
||
**************************************************************************/
|
||
void gui_prepare_clause_updt(struct Treaty *ptreaty, struct player *they)
|
||
void gui_prepare_clause_updt(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct diplomacy_dialog *pdialog = get_diplomacy_dialog(they);
|
||
... | ... | |
/**********************************************************************//**
|
||
Update the diplomacy dialog by adding a clause.
|
||
**************************************************************************/
|
||
void gui_recv_create_clause(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_create_clause(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct diplomacy_dialog *pdialog = get_diplomacy_dialog(they);
|
||
... | ... | |
/**********************************************************************//**
|
||
Update the diplomacy dialog by removing a clause.
|
||
**************************************************************************/
|
||
void gui_recv_remove_clause(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_remove_clause(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct diplomacy_dialog *pdialog = get_diplomacy_dialog(they);
|
||
... | ... | |
/**********************************************************************//**
|
||
Open new diplomacy dialog between players.
|
||
**************************************************************************/
|
||
static struct diplomacy_dialog *create_diplomacy_dialog(struct Treaty *ptreaty,
|
||
static struct diplomacy_dialog *create_diplomacy_dialog(struct treaty *ptreaty,
|
||
struct player *plr0,
|
||
struct player *plr1)
|
||
{
|
||
... | ... | |
Handle the start of a diplomacy meeting - usually by popping up a
|
||
diplomacy dialog.
|
||
**************************************************************************/
|
||
void gui_init_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void gui_init_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
struct diplomacy_dialog *pdialog;
|
client/gui-sdl3/diplodlg.c | ||
---|---|---|
#include "diplodlg.h"
|
||
struct diplomacy_dialog {
|
||
struct Treaty *treaty;
|
||
struct treaty *treaty;
|
||
struct advanced_dialog *pdialog;
|
||
struct advanced_dialog *pwants;
|
||
struct advanced_dialog *poffers;
|
||
... | ... | |
Update a player's acceptance status of a treaty (traditionally shown
|
||
with the thumbs-up/thumbs-down sprite).
|
||
**************************************************************************/
|
||
void gui_recv_accept_treaty(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_accept_treaty(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct diplomacy_dialog *pdialog = get_diplomacy_dialog(they);
|
||
... | ... | |
Update the diplomacy dialog when the meeting is canceled (the dialog
|
||
should be closed).
|
||
**************************************************************************/
|
||
void gui_recv_cancel_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void gui_recv_cancel_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
struct diplomacy_dialog *pdialog = get_diplomacy_dialog(they);
|
||
... | ... | |
/**********************************************************************//**
|
||
Prepare to clause creation or removal.
|
||
**************************************************************************/
|
||
void gui_prepare_clause_updt(struct Treaty *ptreaty, struct player *they)
|
||
void gui_prepare_clause_updt(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct diplomacy_dialog *pdialog = get_diplomacy_dialog(they);
|
||
... | ... | |
/**********************************************************************//**
|
||
Update the diplomacy dialog by adding a clause.
|
||
**************************************************************************/
|
||
void gui_recv_create_clause(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_create_clause(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct diplomacy_dialog *pdialog = get_diplomacy_dialog(they);
|
||
... | ... | |
/**********************************************************************//**
|
||
Update the diplomacy dialog by removing a clause.
|
||
**************************************************************************/
|
||
void gui_recv_remove_clause(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_remove_clause(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
struct diplomacy_dialog *pdialog = get_diplomacy_dialog(they);
|
||
... | ... | |
/**********************************************************************//**
|
||
Open new diplomacy dialog between players.
|
||
**************************************************************************/
|
||
static struct diplomacy_dialog *create_diplomacy_dialog(struct Treaty *ptreaty,
|
||
static struct diplomacy_dialog *create_diplomacy_dialog(struct treaty *ptreaty,
|
||
struct player *plr0,
|
||
struct player *plr1)
|
||
{
|
||
... | ... | |
Handle the start of a diplomacy meeting - usually by popping up a
|
||
diplomacy dialog.
|
||
**************************************************************************/
|
||
void gui_init_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void gui_init_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
struct diplomacy_dialog *pdialog;
|
client/gui-stub/diplodlg.c | ||
---|---|---|
Update a player's acceptance status of a treaty (traditionally shown
|
||
with the thumbs-up/thumbs-down sprite).
|
||
**************************************************************************/
|
||
void gui_gui_recv_accept_treaty(struct Treaty *ptreaty, struct player *they)
|
||
void gui_gui_recv_accept_treaty(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
/* PORTME */
|
||
}
|
||
... | ... | |
Handle the start of a diplomacy meeting - usually by popping up a
|
||
diplomacy dialog.
|
||
**************************************************************************/
|
||
void gui_gui_init_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void gui_gui_init_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
/* PORTME */
|
||
... | ... | |
/**********************************************************************//**
|
||
Update the diplomacy dialog by adding a clause.
|
||
**************************************************************************/
|
||
void gui_gui_recv_create_clause(struct Treaty *ptreaty, struct player *they)
|
||
void gui_gui_recv_create_clause(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
/* PORTME */
|
||
}
|
||
... | ... | |
Update the diplomacy dialog when the meeting is canceled (the dialog
|
||
should be closed).
|
||
**************************************************************************/
|
||
void gui_gui_recv_cancel_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void gui_gui_recv_cancel_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
/* PORTME */
|
||
... | ... | |
/**********************************************************************//**
|
||
Update the diplomacy dialog by removing a clause.
|
||
**************************************************************************/
|
||
void gui_gui_recv_remove_clause(struct Treaty *ptreaty, struct player *they)
|
||
void gui_gui_recv_remove_clause(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
/* PORTME */
|
||
}
|
||
... | ... | |
/**********************************************************************//**
|
||
Prepare to clause creation or removal.
|
||
**************************************************************************/
|
||
void gui_gui_prepare_clause_updt(struct Treaty *ptreaty, struct player *they)
|
||
void gui_gui_prepare_clause_updt(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
/* PORTME */
|
||
}
|
client/gui_interface.c | ||
---|---|---|
/**********************************************************************//**
|
||
Call gui_init_meeting callback
|
||
**************************************************************************/
|
||
void gui_init_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void gui_init_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
funcs.gui_init_meeting(ptreaty, they, initiator);
|
||
... | ... | |
/**********************************************************************//**
|
||
Call gui_recv_cancel_meeting callback
|
||
**************************************************************************/
|
||
void gui_recv_cancel_meeting(struct Treaty *ptreaty, struct player *they,
|
||
void gui_recv_cancel_meeting(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
{
|
||
funcs.gui_recv_cancel_meeting(ptreaty, they, initiator);
|
||
... | ... | |
/**********************************************************************//**
|
||
Call gui_prepare_clause_updt callback
|
||
**************************************************************************/
|
||
void gui_prepare_clause_updt(struct Treaty *ptreaty, struct player *they)
|
||
void gui_prepare_clause_updt(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
funcs.gui_prepare_clause_updt(ptreaty, they);
|
||
}
|
||
... | ... | |
/**********************************************************************//**
|
||
Call gui_recv_create_clause callback
|
||
**************************************************************************/
|
||
void gui_recv_create_clause(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_create_clause(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
funcs.gui_recv_create_clause(ptreaty, they);
|
||
}
|
||
... | ... | |
/**********************************************************************//**
|
||
Call gui_recv_remove_clause callback
|
||
**************************************************************************/
|
||
void gui_recv_remove_clause(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_remove_clause(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
funcs.gui_recv_remove_clause(ptreaty, they);
|
||
}
|
||
... | ... | |
/**********************************************************************//**
|
||
Call gui_recv_accept_treaty callback
|
||
**************************************************************************/
|
||
void gui_recv_accept_treaty(struct Treaty *ptreaty, struct player *they)
|
||
void gui_recv_accept_treaty(struct treaty *ptreaty, struct player *they)
|
||
{
|
||
funcs.gui_recv_accept_treaty(ptreaty, they);
|
||
}
|
client/gui_interface.h | ||
---|---|---|
char **(*get_gui_specific_themes_directories)(int *count);
|
||
char **(*get_usable_themes_in_directory)(const char *directory, int *count);
|
||
void (*gui_init_meeting)(struct Treaty *ptreaty, struct player *they,
|
||
void (*gui_init_meeting)(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator);
|
||
void (*gui_recv_cancel_meeting)(struct Treaty *ptreaty, struct player *they,
|
||
void (*gui_recv_cancel_meeting)(struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator);
|
||
void (*gui_prepare_clause_updt)(struct Treaty *ptreaty, struct player *they);
|
||
void (*gui_recv_create_clause)(struct Treaty *ptreaty, struct player *they);
|
||
void (*gui_recv_remove_clause)(struct Treaty *ptreaty, struct player *they);
|
||
void (*gui_recv_accept_treaty)(struct Treaty *ptreaty, struct player *they);
|
||
void (*gui_prepare_clause_updt)(struct treaty *ptreaty, struct player *they);
|
||
void (*gui_recv_create_clause)(struct treaty *ptreaty, struct player *they);
|
||
void (*gui_recv_remove_clause)(struct treaty *ptreaty, struct player *they);
|
||
void (*gui_recv_accept_treaty)(struct treaty *ptreaty, struct player *they);
|
||
void (*request_action_confirmation)(const char *expl,
|
||
struct act_confirmation_data *data);
|
client/include/diplodlg_g.h | ||
---|---|---|
#include "gui_proto_constructor.h"
|
||
GUI_FUNC_PROTO(void, gui_init_meeting,
|
||
struct Treaty *ptreaty, struct player *they,
|
||
struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
GUI_FUNC_PROTO(void, gui_recv_cancel_meeting,
|
||
struct Treaty *ptreaty, struct player *they,
|
||
struct treaty *ptreaty, struct player *they,
|
||
struct player *initiator)
|
||
GUI_FUNC_PROTO(void, gui_prepare_clause_updt,
|
||
struct Treaty *ptreaty, struct player *they)
|
||
struct treaty *ptreaty, struct player *they)
|
||
GUI_FUNC_PROTO(void, gui_recv_create_clause,
|
||
struct Treaty *ptreaty, struct player *they)
|
||
struct treaty *ptreaty, struct player *they)
|
||
GUI_FUNC_PROTO(void, gui_recv_remove_clause,
|
||
struct Treaty *ptreaty, struct player *they)
|
||
GUI_FUNC_PROTO(void, gui_recv_accept_treaty, struct Treaty *ptreaty,
|
||
struct treaty *ptreaty, struct player *they)
|
||
GUI_FUNC_PROTO(void, gui_recv_accept_treaty, struct treaty *ptreaty,
|
||
struct player *they)
|
||
GUI_FUNC_PROTO(void, close_all_diplomacy_dialogs, void)
|
||
#endif /* FC__DIPLODLG_G_H */
|
||
#endif /* FC__DIPLODLG_G_H */
|
common/ai.h | ||
---|---|---|
# undef DEBUG_AITIMERS
|
||
#endif /* FREECIV_DEBUG */
|
||
struct Treaty;
|
||
struct treaty;
|
||
struct player;
|
||
struct adv_choice;
|
||
struct city;
|
||
... | ... | |
/* Called for player AI type when diplomatic treaty requires evaluation. */
|
||
void (*treaty_evaluate)(struct player *pplayer, struct player *aplayer,
|
||
struct Treaty *ptreaty);
|
||
struct treaty *ptreaty);
|
||
/* Called for player AI type when diplomatic treaty has been accepted
|
||
* by both parties. */
|
||
void (*treaty_accepted)(struct player *pplayer, struct player *aplayer,
|
||
struct Treaty *ptreaty);
|
||
struct treaty *ptreaty);
|
||
/* Called for player AI type when first contact with another player has been
|
||
* established. Note that when contact is between two AI players, callback
|
common/diptreaty.c | ||
---|---|---|
/**********************************************************************//**
|
||
Initialize treaty structure between two players.
|
||
**************************************************************************/
|
||
void init_treaty(struct Treaty *ptreaty,
|
||
void init_treaty(struct treaty *ptreaty,
|
||
struct player *plr0, struct player *plr1)
|
||
{
|
||
ptreaty->plr0=plr0;
|
||
ptreaty->plr1=plr1;
|
||
ptreaty->plr0 = plr0;
|
||
ptreaty->plr1 = plr1;
|
||
ptreaty->accept0 = FALSE;
|
||
ptreaty->accept1 = FALSE;
|
||
ptreaty->clauses = clause_list_new();
|
||
... | ... | |
/**********************************************************************//**
|
||
Free the clauses of a treaty.
|
||
**************************************************************************/
|
||
void clear_treaty(struct Treaty *ptreaty)
|
||
void clear_treaty(struct treaty *ptreaty)
|
||
{
|
||
clause_list_iterate(ptreaty->clauses, pclause) {
|
||
free(pclause);
|
||
... | ... | |
/**********************************************************************//**
|
||
Remove clause from treaty
|
||
**************************************************************************/
|
||
bool remove_clause(struct Treaty *ptreaty, struct player *pfrom,
|
||
bool remove_clause(struct treaty *ptreaty, struct player *pfrom,
|
||
enum clause_type type, int val)
|
||
{
|
||
clause_list_iterate(ptreaty->clauses, pclause) {
|
||
... | ... | |
/**********************************************************************//**
|
||
Add clause to treaty.
|
||
**************************************************************************/
|
||
bool add_clause(struct Treaty *ptreaty, struct player *pfrom,
|
||
bool add_clause(struct treaty *ptreaty, struct player *pfrom,
|
||
enum clause_type type, int val,
|
||
struct player *client_player)
|
||
{
|
||
... | ... | |
/**********************************************************************//**
|
||
Find currently active treaty between two players.
|
||
**************************************************************************/
|
||
struct Treaty *find_treaty(struct player *plr0, struct player *plr1)
|
||
struct treaty *find_treaty(struct player *plr0, struct player *plr1)
|
||
{
|
||
treaty_list_iterate(treaties, ptreaty) {
|
||
if ((ptreaty->plr0 == plr0 && ptreaty->plr1 == plr1)
|
||
... | ... | |
/**********************************************************************//**
|
||
Add treaty to the global list.
|
||
**************************************************************************/
|
||
void treaty_add(struct Treaty *ptreaty)
|
||
void treaty_add(struct treaty *ptreaty)
|
||
{
|
||
treaty_list_prepend(treaties, ptreaty);
|
||
}
|
||
... | ... | |
/**********************************************************************//**
|
||
Remove treaty from the global list.
|
||
**************************************************************************/
|
||
void treaty_remove(struct Treaty *ptreaty)
|
||
void treaty_remove(struct treaty *ptreaty)
|
||
{
|
||
treaty_list_remove(treaties, ptreaty);
|
||
common/diptreaty.h | ||
---|---|---|
int value;
|
||
};
|
||
struct Treaty {
|
||
struct treaty {
|
||
struct player *plr0, *plr1;
|
||
bool accept0, accept1;
|
||
struct clause_list *clauses;
|
||
... | ... | |
bool could_intel_with_player(const struct player *pplayer,
|
||
const struct player *aplayer);
|
||
void init_treaty(struct Treaty *ptreaty,
|
||
void init_treaty(struct treaty *ptreaty,
|
||
struct player *plr0, struct player *plr1);
|
||
bool add_clause(struct Treaty *ptreaty, struct player *pfrom,
|
||
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,
|
||
bool remove_clause(struct treaty *ptreaty, struct player *pfrom,
|
||
enum clause_type type, int val);
|
||
void clear_treaty(struct Treaty *ptreaty);
|
||
void clear_treaty(struct treaty *ptreaty);
|
||
void clause_infos_init(void);
|
||
void clause_infos_free(void);
|
||
... | ... | |
bool clause_enabled(enum clause_type type);
|
||
#define SPECLIST_TAG treaty
|
||
#define SPECLIST_TYPE struct Treaty
|
||
#define SPECLIST_TYPE struct treaty
|
||
#include "speclist.h"
|
||
#define treaty_list_iterate(list, p) \
|
||
TYPED_LIST_ITERATE(struct Treaty, list, p)
|
||
TYPED_LIST_ITERATE(struct treaty, list, p)
|
||
#define treaty_list_iterate_end LIST_ITERATE_END
|
||
void treaties_init(void);
|
||
void treaties_free(void);
|
||
void free_treaties(void);
|
||
struct Treaty *find_treaty(struct player *plr0, struct player *plr1);
|
||
struct treaty *find_treaty(struct player *plr0, struct player *plr1);
|
||
void treaty_add(struct Treaty *ptreaty);
|
||
void treaty_remove(struct Treaty *ptreaty);
|
||
void treaty_add(struct treaty *ptreaty);
|
||
void treaty_remove(struct treaty *ptreaty);
|
||
typedef void (*treaty_cb)(struct Treaty *, void *data);
|
||
typedef void (*treaty_cb)(struct treaty *, void *data);
|
||
void treaties_iterate(treaty_cb cb, void *data);
|
||
#ifdef __cplusplus
|
doc/HACKING | ||
---|---|---|
Diplomacy
|
||
=========================================================================
|
||
A few words about the diplomacy system. When a diplomacy meeting is
|
||
established, a Treaty structure is created on both of the clients and
|
||
established, a treaty structure is created on both of the clients and
|
||
on the server. All these structures are updated concurrently as clauses
|
||
are added and removed.
|
||
server/diplhand.c | ||
---|---|---|
Calls treaty_evaluate function if such is set for AI player.
|
||
**************************************************************************/
|
||
static void call_treaty_evaluate(struct player *pplayer, struct player *aplayer,
|
||
struct Treaty *ptreaty)
|
||
struct treaty *ptreaty)
|
||
{
|
||
if (is_ai(pplayer)) {
|
||
CALL_PLR_AI_FUNC(treaty_evaluate, pplayer, pplayer, aplayer, ptreaty);
|
||
... | ... | |
Calls treaty_accepted function if such is set for AI player.
|
||
**************************************************************************/
|
||
static void call_treaty_accepted(struct player *pplayer, struct player *aplayer,
|
||
struct Treaty *ptreaty)
|
||
struct treaty *ptreaty)
|
||
{
|
||
if (is_ai(pplayer)) {
|
||
CALL_PLR_AI_FUNC(treaty_accepted, pplayer, pplayer, aplayer, ptreaty);
|
||
... | ... | |
agreed clauses.
|
||
**************************************************************************/
|
||
void handle_diplomacy_accept_treaty_req(struct player *pplayer,
|
||
int counterpart)
|
||
int counterpart)
|
||
{
|
||
struct Treaty *ptreaty;
|
||
struct treaty *ptreaty;
|
||
bool *player_accept, *other_accept;
|
||
enum dipl_reason diplcheck;
|
||
bool worker_refresh_required = FALSE;
|
||
... | ... | |
Handle request to remove clause from treaty.
|
||
**************************************************************************/
|
||
void handle_diplomacy_remove_clause_req(struct player *pplayer,
|
||
int counterpart, int giver,
|
||
enum clause_type type, int value)
|
||
int counterpart, int giver,
|
||
enum clause_type type, int value)
|
||
{
|
||
struct Treaty *ptreaty;
|
||
struct treaty *ptreaty;
|
||
struct player *pgiver = player_by_number(giver);
|
||
struct player *pother = player_by_number(counterpart);
|
||
... | ... | |
Handle request to add clause to treaty between two players.
|
||
**************************************************************************/
|
||
void handle_diplomacy_create_clause_req(struct player *pplayer,
|
||
int counterpart, int giver,
|
||
enum clause_type type, int value)
|
||
int counterpart, int giver,
|
||
enum clause_type type, int value)
|
||
{
|
||
struct Treaty *ptreaty;
|
||
struct treaty *ptreaty;
|
||
struct player *pgiver = player_by_number(giver);
|
||
struct player *pother = player_by_number(counterpart);
|
||
... | ... | |
this with input directly from untrusted source.
|
||
**************************************************************************/
|
||
static void really_diplomacy_cancel_meeting(struct player *pplayer,
|
||
struct player *pother)
|
||
struct player *pother)
|
||
{
|
||
struct Treaty *ptreaty = find_treaty(pplayer, pother);
|
||
struct treaty *ptreaty = find_treaty(pplayer, pother);
|
||
if (ptreaty) {
|
||
dlsend_packet_diplomacy_cancel_meeting(pother->connections,
|
||
... | ... | |
Handle meeting opening request.
|
||
**************************************************************************/
|
||
void handle_diplomacy_init_meeting_req(struct player *pplayer,
|
||
int counterpart)
|
||
int counterpart)
|
||
{
|
||
struct player *pother = player_by_number(counterpart);
|
||
... | ... | |
}
|
||
if (could_meet_with_player(pplayer, pother)) {
|
||
struct Treaty *ptreaty;
|
||
struct treaty *ptreaty;
|
||
ptreaty = fc_malloc(sizeof(*ptreaty));
|
||
init_treaty(ptreaty, pplayer, pother);
|
||
... | ... | |
return;
|
||
}
|
||
players_iterate(other) {
|
||
struct Treaty *ptreaty = find_treaty(pplayer, other);
|
||
struct treaty *ptreaty = find_treaty(pplayer, other);
|
||
if (ptreaty) {
|
||
fc_assert_action(pplayer != other, continue);
|
||
... | ... | |
**************************************************************************/
|
||
void reject_all_treaties(struct player *pplayer)
|
||
{
|
||
struct Treaty* treaty;
|
||
struct treaty *treaty;
|
||
players_iterate(pplayer2) {
|
||
treaty = find_treaty(pplayer, pplayer2);
|
||
if (!treaty) {
|
||
if (treaty == nullptr) {
|
||
continue;
|
||
}
|
||
treaty->accept0 = FALSE;
|
server/diplhand.h | ||
---|---|---|
/* server */
|
||
#include <hand_gen.h> /* <> so looked from the build directory first. */
|
||
struct Treaty;
|
||
struct packet_diplomacy_info;
|
||
struct connection;
|
||
server/savegame/savegame2.c | ||
---|---|---|
if (p0 == NULL || p1 == NULL) {
|
||
log_error("Treaty between unknown players %s and %s", plr0, plr1);
|
||
} else {
|
||
struct Treaty *ptreaty = fc_malloc(sizeof(*ptreaty));
|
||
struct treaty *ptreaty = fc_malloc(sizeof(*ptreaty));
|
||
init_treaty(ptreaty, p0, p1);
|
||
treaty_add(ptreaty);
|
server/savegame/savegame3.c | ||
---|---|---|
if (p0 == NULL || p1 == NULL) {
|
||
log_error("Treaty between unknown players %s and %s", plr0, plr1);
|
||
} else {
|
||
struct Treaty *ptreaty = fc_malloc(sizeof(*ptreaty));
|
||
struct treaty *ptreaty = fc_malloc(sizeof(*ptreaty));
|
||
init_treaty(ptreaty, p0, p1);
|
||
treaty_add(ptreaty);
|
||
... | ... | |
/************************************************************************//**
|
||
Save '[treaty_xxx]'.
|
||
****************************************************************************/
|
||
static void treaty_save(struct Treaty *ptr, void *data_in)
|
||
static void treaty_save(struct treaty *ptr, void *data_in)
|
||
{
|
||
char tpath[512];
|
||
int cidx = 0;
|