Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/gui-sdl2/diplodlg.c File Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
diplodlg.c File Reference
`#include <SDL2/SDL.h>`
`#include "fcintl.h"`
`#include "log.h"`
`#include "diptreaty.h"`
`#include "game.h"`
`#include "research.h"`
`#include "client_main.h"`
`#include "climisc.h"`
`#include "packhand.h"`
`#include "chatline.h"`
`#include "colors.h"`
`#include "dialogs.h"`
`#include "graphics.h"`
`#include "gui_id.h"`
`#include "gui_main.h"`
`#include "gui_tilespec.h"`
`#include "mapview.h"`
`#include "themespec.h"`
`#include "widget.h"`
`#include "diplodlg.h"`
`#include "speclist.h"`

Go to the source code of this file.

## Data Structures

struct | diplomacy_dialog

## Macros

#define | SPECLIST_TAG dialog
#define | SPECLIST_TYPE struct diplomacy_dialog
#define | dialog_list_iterate(dialoglist, pdialog) TYPED_LIST_ITERATE(struct diplomacy_dialog, dialoglist, pdialog)
#define | dialog_list_iterate_end LIST_ITERATE_END

## Functions

static void | update_diplomacy_dialog (struct diplomacy_dialog *pdialog)
static void | update_acceptance_icons (struct diplomacy_dialog *pdialog)
static void | update_clauses_list (struct diplomacy_dialog *pdialog)
static void | remove_clause_widget_from_list (int counterpart, int giver, enum clause_type type, int value)
static void | popdown_diplomacy_dialog (struct diplomacy_dialog *pdialog)
static void | popdown_diplomacy_dialogs (void)
static void | popdown_sdip_dialog (void)
void | diplomacy_dialog_init (void)
void | diplomacy_dialog_done (void)
static struct diplomacy_dialog * | get_diplomacy_dialog (int other_player_id)
void | handle_diplomacy_accept_treaty (int counterpart, bool I_accepted, bool other_accepted)
void | handle_diplomacy_cancel_meeting (int counterpart, int initiated_from)
static int | remove_clause_callback (struct widget *pwidget)
void | handle_diplomacy_create_clause (int counterpart, int giver, enum clause_type type, int value)
void | handle_diplomacy_remove_clause (int counterpart, int giver, enum clause_type type, int value)
static int | cancel_meeting_callback (struct widget *pwidget)
static int | accept_treaty_callback (struct widget *pwidget)
static int | pact_callback (struct widget *pwidget)
static int | vision_callback (struct widget *pwidget)
static int | embassy_callback (struct widget *pwidget)
static int | maps_callback (struct widget *pwidget)
static int | techs_callback (struct widget *pwidget)
static int | gold_callback (struct widget *pwidget)
static int | cities_callback (struct widget *pwidget)
static int | dipomatic_window_callback (struct widget *pwindow)
static struct advanced_dialog * | popup_diplomatic_objects (struct player *pplayer0, struct player *pplayer1, struct widget *main_window, bool L_R)
static struct diplomacy_dialog * | create_diplomacy_dialog (struct player *plr0, struct player *plr1)
void | handle_diplomacy_init_meeting (int counterpart, int initiated_from)
void | close_all_diplomacy_dialogs (void)
static int | sdip_window_callback (struct widget *pwindow)
static int | withdraw_vision_dlg_callback (struct widget *pwidget)
static int | cancel_pact_dlg_callback (struct widget *pwidget)
static int | call_meeting_dlg_callback (struct widget *pwidget)
static int | cancel_sdip_dlg_callback (struct widget *pwidget)
static void | popup_war_dialog (struct player *pplayer)
void | popup_diplomacy_dialog (struct player *pplayer)

## Variables

static struct dialog_list * | dialog_list
static struct small_dialog * | spy_dlg = NULL

## Macro Definition Documentation

## ◆ dialog_list_iterate

#define dialog_list_iterate | ( |  | dialoglist,
|  |  | pdialog
| ) |  | TYPED_LIST_ITERATE(struct diplomacy_dialog, dialoglist, pdialog)

Definition at line 64 of file diplodlg.c.

## ◆ dialog_list_iterate_end

#define dialog_list_iterate_end LIST_ITERATE_END

Definition at line 66 of file diplodlg.c.

## ◆ SPECLIST_TAG

#define SPECLIST_TAG dialog

Definition at line 60 of file diplodlg.c.

## ◆ SPECLIST_TYPE

#define SPECLIST_TYPE struct diplomacy_dialog

Definition at line 61 of file diplodlg.c.

## Function Documentation

## ◆ accept_treaty_callback()

static int accept_treaty_callback | ( | struct widget * | pwidget | ) |

static

User interacted with accept treaty -widget.

Definition at line 241 of file diplodlg.c.

Referenced by update_diplomacy_dialog().

## ◆ call_meeting_dlg_callback()

static int call_meeting_dlg_callback | ( | struct widget * | pwidget | ) |

static

User interacted with call meeting -widget.

Definition at line 1372 of file diplodlg.c.

Referenced by popup_diplomacy_dialog().

## ◆ cancel_meeting_callback()

static int cancel_meeting_callback | ( | struct widget * | pwidget | ) |

static

User interacted with cancel meeting -widget.

Definition at line 228 of file diplodlg.c.

Referenced by update_diplomacy_dialog().

## ◆ cancel_pact_dlg_callback()

static int cancel_pact_dlg_callback | ( | struct widget * | pwidget | ) |

static

User interacted with cancel pact -widget.

Definition at line 1355 of file diplodlg.c.

Referenced by popup_diplomacy_dialog(), and popup_war_dialog().

## ◆ cancel_sdip_dlg_callback()

static int cancel_sdip_dlg_callback | ( | struct widget * | pwidget | ) |

static

User interacted with cancel small diplomacy dialog -widget.

Definition at line 1391 of file diplodlg.c.

Referenced by popup_diplomacy_dialog(), and popup_war_dialog().

## ◆ cities_callback()

static int cities_callback | ( | struct widget * | pwidget | ) |

static

User interacted with city -widget.

Definition at line 429 of file diplodlg.c.

Referenced by popup_diplomatic_objects().

## ◆ close_all_diplomacy_dialogs()

void close_all_diplomacy_dialogs | ( | void |  | ) |

Close all open diplomacy dialogs, for when client disconnects from game.

Definition at line 1300 of file diplodlg.c.

## ◆ create_diplomacy_dialog()

static struct diplomacy_dialog * create_diplomacy_dialog | ( | struct player * | plr0,
|  | struct player * | plr1
| ) |  |

static

Open new diplomacy dialog between players.

Definition at line 874 of file diplodlg.c.

## ◆ diplomacy_dialog_done()

void diplomacy_dialog_done | ( | void |  | ) |

Free resources allocated for diplomacy dialog system.

Definition at line 90 of file diplodlg.c.

## ◆ diplomacy_dialog_init()

void diplomacy_dialog_init | ( | void |  | ) |

Initialialize diplomacy dialog system.

Definition at line 82 of file diplodlg.c.

## ◆ dipomatic_window_callback()

static int dipomatic_window_callback | ( | struct widget * | pwindow | ) |

static

User interacted with Diplomacy meeting -window.

Definition at line 451 of file diplodlg.c.

Referenced by popup_diplomatic_objects(), and update_diplomacy_dialog().

## ◆ embassy_callback()

static int embassy_callback | ( | struct widget * | pwidget | ) |

static

User interacted with embassy -widget.

Definition at line 311 of file diplodlg.c.

Referenced by popup_diplomatic_objects().

## ◆ get_diplomacy_dialog()

static struct diplomacy_dialog * get_diplomacy_dialog | ( | int | other_player_id | ) |

static

Get diplomacy dialog between client user and other player.

Definition at line 98 of file diplodlg.c.

Referenced by cities_callback(), embassy_callback(), gold_callback(), handle_diplomacy_accept_treaty(), handle_diplomacy_cancel_meeting(), handle_diplomacy_create_clause(), handle_diplomacy_init_meeting(), handle_diplomacy_remove_clause(), maps_callback(), pact_callback(), remove_clause_callback(), remove_clause_widget_from_list(), techs_callback(), and vision_callback().

## ◆ gold_callback()

static int gold_callback | ( | struct widget * | pwidget | ) |

static

User interacted with gold -widget.

Definition at line 385 of file diplodlg.c.

Referenced by popup_diplomatic_objects().

## ◆ handle_diplomacy_accept_treaty()

void handle_diplomacy_accept_treaty | ( | int | counterpart,
|  | bool | I_accepted,
|  | bool | other_accepted
| ) |  |

Update a player's acceptance status of a treaty (traditionally shown with the thumbs-up/thumbs-down sprite).

Definition at line 117 of file diplodlg.c.

## ◆ handle_diplomacy_cancel_meeting()

void handle_diplomacy_cancel_meeting | ( | int | counterpart,
|  | int | initiated_from
| ) |  |

Update the diplomacy dialog when the meeting is canceled (the dialog should be closed).

Definition at line 136 of file diplodlg.c.

## ◆ handle_diplomacy_create_clause()

void handle_diplomacy_create_clause | ( | int | counterpart,
|  | int | giver,
|  | enum clause_type | type,
|  | int | value
| ) |  |

Update the diplomacy dialog by adding a clause.

Definition at line 175 of file diplodlg.c.

## ◆ handle_diplomacy_init_meeting()

void handle_diplomacy_init_meeting | ( | int | counterpart,
|  | int | initiated_from
| ) |  |

Handle the start of a diplomacy meeting - usually by popping up a diplomacy dialog.

Definition at line 1236 of file diplodlg.c.

## ◆ handle_diplomacy_remove_clause()

void handle_diplomacy_remove_clause | ( | int | counterpart,
|  | int | giver,
|  | enum clause_type | type,
|  | int | value
| ) |  |

Update the diplomacy dialog by removing a clause.

Definition at line 201 of file diplodlg.c.

## ◆ maps_callback()

static int maps_callback | ( | struct widget * | pwidget | ) |

static

User interacted with map -widget.

Definition at line 332 of file diplodlg.c.

Referenced by popup_diplomatic_objects().

## ◆ pact_callback()

static int pact_callback | ( | struct widget * | pwidget | ) |

static

User interacted with pact selection -widget.

Definition at line 256 of file diplodlg.c.

Referenced by popup_diplomatic_objects().

## ◆ popdown_diplomacy_dialog()

static void popdown_diplomacy_dialog | ( | struct diplomacy_dialog * | pdialog | ) |

static

Close diplomacy dialog between client user and given counterpart.

Definition at line 1263 of file diplodlg.c.

Referenced by handle_diplomacy_cancel_meeting(), and popdown_diplomacy_dialogs().

## ◆ popdown_diplomacy_dialogs()

static void popdown_diplomacy_dialogs | ( | void |  | ) |

static

Popdown all diplomacy dialogs

Definition at line 1288 of file diplodlg.c.

Referenced by close_all_diplomacy_dialogs().

## ◆ popdown_sdip_dialog()

static void popdown_sdip_dialog | ( | void |  | ) |

static

Close small diplomacy dialog.

Definition at line 1314 of file diplodlg.c.

Referenced by call_meeting_dlg_callback(), cancel_pact_dlg_callback(), cancel_sdip_dlg_callback(), close_all_diplomacy_dialogs(), and withdraw_vision_dlg_callback().

## ◆ popup_diplomacy_dialog()

void popup_diplomacy_dialog | ( | struct player * | pplayer | ) |

Open diplomacy dialog between client user and given player.

Definition at line 1523 of file diplodlg.c.

## ◆ popup_diplomatic_objects()

static struct advanced_dialog * popup_diplomatic_objects | ( | struct player * | pplayer0,
|  | struct player * | pplayer1,
|  | struct widget * | main_window,
|  | bool | L_R
| ) |  |

static

Create treaty widgets. Pact (that will always be both ways) related widgets are created only when pplayer0 is client user.

Definition at line 460 of file diplodlg.c.

Referenced by update_diplomacy_dialog().

## ◆ popup_war_dialog()

static void popup_war_dialog | ( | struct player * | pplayer | ) |

static

Open war declaring dialog after some incident caused by pplayer.

Definition at line 1404 of file diplodlg.c.

Referenced by popup_diplomacy_dialog().

## ◆ remove_clause_callback()

static int remove_clause_callback | ( | struct widget * | pwidget | ) |

static

User interacted with remove clause -widget.

Definition at line 152 of file diplodlg.c.

Referenced by update_clauses_list().

## ◆ remove_clause_widget_from_list()

static void remove_clause_widget_from_list | ( | int | counterpart,
|  | int | giver,
|  | enum clause_type | type,
|  | int | value
| ) |  |

static

Remove widget related to clause from list of widgets.

Definition at line 1179 of file diplodlg.c.

Referenced by handle_diplomacy_create_clause(), and handle_diplomacy_remove_clause().

## ◆ sdip_window_callback()

static int sdip_window_callback | ( | struct widget * | pwindow | ) |

static

User interacted with small diplomacy window.

Definition at line 1326 of file diplodlg.c.

Referenced by popup_diplomacy_dialog(), and popup_war_dialog().

## ◆ techs_callback()

static int techs_callback | ( | struct widget * | pwidget | ) |

static

User interacted with tech -widget.

Definition at line 363 of file diplodlg.c.

Referenced by popup_diplomatic_objects().

## ◆ update_acceptance_icons()

static void update_acceptance_icons | ( | struct diplomacy_dialog * | pdialog | ) |

static

Update treaty acceptance icons (accepted / rejected)

Definition at line 1069 of file diplodlg.c.

Referenced by handle_diplomacy_accept_treaty(), handle_diplomacy_create_clause(), and handle_diplomacy_remove_clause().

## ◆ update_clauses_list()

static void update_clauses_list | ( | struct diplomacy_dialog * | pdialog | ) |

static

Refresh diplomacy dialog when list of clauses has been changed.

Definition at line 1116 of file diplodlg.c.

Referenced by handle_diplomacy_create_clause(), and handle_diplomacy_remove_clause().

## ◆ update_diplomacy_dialog()

static void update_diplomacy_dialog | ( | struct diplomacy_dialog * | pdialog | ) |

static

Update diplomacy dialog information.

Definition at line 891 of file diplodlg.c.

## ◆ vision_callback()

static int vision_callback | ( | struct widget * | pwidget | ) |

static

User interacted with shared vision -widget.

Definition at line 290 of file diplodlg.c.

Referenced by popup_diplomatic_objects().

## ◆ withdraw_vision_dlg_callback()

static int withdraw_vision_dlg_callback | ( | struct widget * | pwidget | ) |

static

User interacted with withdraw vision -widget.

Definition at line 1338 of file diplodlg.c.

Referenced by popup_diplomacy_dialog().

## Variable Documentation

## ◆ dialog_list

struct dialog_list* dialog_list

static

Definition at line 68 of file diplodlg.c.

## ◆ spy_dlg

struct small_dialog* spy_dlg = NULL

static

Definition at line 1309 of file diplodlg.c.

Referenced by popdown_sdip_dialog(), popup_diplomacy_dialog(), popup_war_dialog(), and sdip_window_callback().