Freeciv-3.3
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions | Variables
action_dialog.c File Reference
#include "astring.h"
#include "fcintl.h"
#include "log.h"
#include "actions.h"
#include "game.h"
#include "movement.h"
#include "research.h"
#include "traderoutes.h"
#include "unitlist.h"
#include "client_main.h"
#include "climisc.h"
#include "control.h"
#include "text.h"
#include "citydlg.h"
#include "colors.h"
#include "dialogs.h"
#include "graphics.h"
#include "gui_id.h"
#include "gui_tilespec.h"
#include "mapview.h"
#include "repodlgs.h"
#include "themespec.h"
#include "widget.h"
#include "dialogs_g.h"

Go to the source code of this file.

Data Structures

struct  diplomat_dialog
 
struct  small_diplomat_dialog
 

Typedefs

typedef int(* act_func) (struct widget *)
 

Functions

void popdown_diplomat_dialog (void)
 
void popdown_incite_dialog (void)
 
void popdown_bribe_dialog (void)
 
static void act_sel_done_primary (int actor_unit_id)
 
static void act_sel_done_secondary (int actor_unit_id)
 
void action_selection_no_longer_in_progress_gui_specific (int actor_id)
 
static action_id get_non_targeted_action_id (action_id tgt_action_id)
 
static action_id get_production_targeted_action_id (action_id tgt_action_id)
 
static int diplomat_dlg_window_callback (struct widget *pwindow)
 
static int spy_strike_bld_request (struct widget *pwidget)
 
static int spy_sabotage_request (struct widget *pwidget)
 
static int spy_sabotage_esc_request (struct widget *pwidget)
 
static int spy_steal_dlg_window_callback (struct widget *pwindow)
 
static int exit_spy_tgt_dlg_callback (struct widget *pwidget)
 
static int spy_steal_callback (struct widget *pwidget)
 
static int spy_steal_popup_shared (struct widget *pwidget)
 
static int spy_steal_popup (struct widget *pwidget)
 
static int spy_steal_esc_popup (struct widget *pwidget)
 
static int diplomat_incite_callback (struct widget *pwidget)
 
static int spy_incite_callback (struct widget *pwidget)
 
static int act_sel_wait_callback (struct widget *pwidget)
 
static int diplomat_bribe_unit_callback (struct widget *pwidget)
 
static int diplomat_bribe_stack_callback (struct widget *pwidget)
 
static int found_city_callback (struct widget *pwidget)
 
static int upgrade_callback (struct widget *pwidget)
 
static int simple_action_callback (struct widget *pwidget)
 
static int diplomat_close_callback (struct widget *pwidget)
 
static void action_entry (const action_id act, const struct act_prob *act_probs, struct unit *act_unit, struct tile *tgt_tile, struct city *tgt_city, struct unit *tgt_unit, struct widget *pwindow, SDL_Rect *area)
 
void popup_action_selection (struct unit *actor_unit, struct city *target_city, struct unit *target_unit, struct tile *target_tile, struct extra_type *target_extra, const struct act_prob *act_probs)
 
int action_selection_actor_unit (void)
 
int action_selection_target_city (void)
 
int action_selection_target_unit (void)
 
int action_selection_target_tile (void)
 
int action_selection_target_extra (void)
 
void action_selection_refresh (struct unit *actor_unit, struct city *target_city, struct unit *target_unit, struct tile *target_tile, struct extra_type *target_extra, const struct act_prob *act_probs)
 
void action_selection_close (void)
 
static int sabotage_impr_callback (struct widget *pwidget)
 
void popup_sabotage_dialog (struct unit *actor, struct city *pcity, const struct action *paction)
 
static int incite_dlg_window_callback (struct widget *pwindow)
 
static int diplomat_incite_yes_callback (struct widget *pwidget)
 
static int exit_incite_dlg_callback (struct widget *pwidget)
 
void popup_incite_dialog (struct unit *actor, struct city *pcity, int cost, const struct action *paction)
 
static int bribe_dlg_window_callback (struct widget *pwindow)
 
static int diplomat_bribe_unit_yes_callback (struct widget *pwidget)
 
static int diplomat_bribe_stack_yes_callback (struct widget *pwidget)
 
static int exit_bribe_dlg_callback (struct widget *pwidget)
 
void popup_bribe_unit_dialog (struct unit *actor, struct unit *punit, int cost, const struct action *paction)
 
void popup_bribe_stack_dialog (struct unit *actor, struct tile *ptile, int cost, const struct action *paction)
 

Variables

bool is_unit_move_blocked
 
static struct diplomat_dialogdiplomat_dlg = NULL
 
static bool is_more_user_input_needed = FALSE
 
static bool did_not_decide = FALSE
 
static const act_func af_map [ACTION_COUNT]
 
static struct small_diplomat_dialogincite_dlg = NULL
 
static struct small_diplomat_dialogbribe_dlg = NULL
 

Typedef Documentation

◆ act_func

typedef int(* act_func) (struct widget *)

Definition at line 51 of file action_dialog.c.

Function Documentation

◆ act_sel_done_primary()

static void act_sel_done_primary ( int  actor_unit_id)
static

The action selection is done.

Definition at line 82 of file action_dialog.c.

Referenced by act_sel_done_secondary(), and popdown_diplomat_dialog().

◆ act_sel_done_secondary()

static void act_sel_done_secondary ( int  actor_unit_id)
static

◆ act_sel_wait_callback()

static int act_sel_wait_callback ( struct widget pwidget)
static

Delay selection of what action to take.

Definition at line 635 of file action_dialog.c.

◆ action_entry()

static void action_entry ( const action_id  act,
const struct act_prob act_probs,
struct unit act_unit,
struct tile tgt_tile,
struct city tgt_city,
struct unit tgt_unit,
struct widget pwindow,
SDL_Rect area 
)
static

Add an entry for an action in the action choice dialog.

Definition at line 890 of file action_dialog.c.

◆ action_selection_actor_unit()

int action_selection_actor_unit ( void  )

Returns the id of the actor unit currently handled in action selection dialog when the action selection dialog is open. Returns IDENTITY_NUMBER_ZERO if no action selection dialog is open.

Definition at line 1177 of file action_dialog.c.

◆ action_selection_close()

void action_selection_close ( void  )

Closes the action selection dialog

Definition at line 1266 of file action_dialog.c.

◆ action_selection_no_longer_in_progress_gui_specific()

void action_selection_no_longer_in_progress_gui_specific ( int  actor_id)

Let the non shared client code know that the action selection process no longer is in progress for the specified unit.

This allows the client to clean up any client specific assumptions.

Definition at line 134 of file action_dialog.c.

◆ action_selection_refresh()

void action_selection_refresh ( struct unit actor_unit,
struct city target_city,
struct unit target_unit,
struct tile target_tile,
struct extra_type target_extra,
const struct act_prob act_probs 
)

Updates the action selection dialog with new information.

Definition at line 1249 of file action_dialog.c.

◆ action_selection_target_city()

int action_selection_target_city ( void  )

Returns id of the target city of the actions currently handled in action selection dialog when the action selection dialog is open and it has a city target. Returns IDENTITY_NUMBER_ZERO if no action selection dialog is open or no city target is present in the action selection dialog.

Definition at line 1192 of file action_dialog.c.

◆ action_selection_target_extra()

int action_selection_target_extra ( void  )

Returns id of the target extra of the actions currently handled in action selection dialog when the action selection dialog is open and it has an extra target. Returns EXTRA_NONE if no action selection dialog is open or no extra target is present in the action selection dialog.

Definition at line 1237 of file action_dialog.c.

◆ action_selection_target_tile()

int action_selection_target_tile ( void  )

Returns id of the target tile of the actions currently handled in action selection dialog when the action selection dialog is open and it has a tile target. Returns TILE_INDEX_NONE if no action selection dialog is open.

Definition at line 1222 of file action_dialog.c.

◆ action_selection_target_unit()

int action_selection_target_unit ( void  )

Returns id of the target unit of the actions currently handled in action selection dialog when the action selection dialog is open and it has a unit target. Returns IDENTITY_NUMBER_ZERO if no action selection dialog is open or no unit target is present in the action selection dialog.

Definition at line 1207 of file action_dialog.c.

◆ bribe_dlg_window_callback()

static int bribe_dlg_window_callback ( struct widget pwindow)
static

User interacted with bribe dialog window.

Definition at line 1833 of file action_dialog.c.

Referenced by popup_bribe_stack_dialog(), and popup_bribe_unit_dialog().

◆ diplomat_bribe_stack_callback()

static int diplomat_bribe_stack_callback ( struct widget pwidget)
static

Ask the server how much the bribe costs

Definition at line 672 of file action_dialog.c.

◆ diplomat_bribe_stack_yes_callback()

static int diplomat_bribe_stack_yes_callback ( struct widget pwidget)
static

User confirmed stack bribe.

Definition at line 1862 of file action_dialog.c.

Referenced by popup_bribe_stack_dialog().

◆ diplomat_bribe_unit_callback()

static int diplomat_bribe_unit_callback ( struct widget pwidget)
static

Ask the server how much the bribe costs

Definition at line 650 of file action_dialog.c.

◆ diplomat_bribe_unit_yes_callback()

static int diplomat_bribe_unit_yes_callback ( struct widget pwidget)
static

User confirmed unit bribe.

Definition at line 1845 of file action_dialog.c.

Referenced by popup_bribe_unit_dialog().

◆ diplomat_close_callback()

static int diplomat_close_callback ( struct widget pwidget)
static

Close diplomat dialog.

Definition at line 833 of file action_dialog.c.

Referenced by popup_action_selection().

◆ diplomat_dlg_window_callback()

static int diplomat_dlg_window_callback ( struct widget pwindow)
static

User interacted with diplomat dialog.

Definition at line 187 of file action_dialog.c.

Referenced by popup_action_selection(), and popup_sabotage_dialog().

◆ diplomat_incite_callback()

static int diplomat_incite_callback ( struct widget pwidget)
static

Ask the server how much the revolt is going to cost us

Definition at line 591 of file action_dialog.c.

◆ diplomat_incite_yes_callback()

static int diplomat_incite_yes_callback ( struct widget pwidget)
static

User confirmed incite

Definition at line 1581 of file action_dialog.c.

Referenced by popup_incite_dialog().

◆ exit_bribe_dlg_callback()

static int exit_bribe_dlg_callback ( struct widget pwidget)
static

Close bribe dialog.

Definition at line 1878 of file action_dialog.c.

Referenced by popup_bribe_stack_dialog(), and popup_bribe_unit_dialog().

◆ exit_incite_dlg_callback()

static int exit_incite_dlg_callback ( struct widget pwidget)
static

Close incite dialog.

Definition at line 1599 of file action_dialog.c.

Referenced by popup_incite_dialog().

◆ exit_spy_tgt_dlg_callback()

static int exit_spy_tgt_dlg_callback ( struct widget pwidget)
static

Exit spy's steal or sabotage dialog.

Definition at line 277 of file action_dialog.c.

Referenced by popup_sabotage_dialog(), and spy_steal_popup_shared().

◆ found_city_callback()

static int found_city_callback ( struct widget pwidget)
static

User clicked "Found City"

Definition at line 692 of file action_dialog.c.

◆ get_non_targeted_action_id()

static action_id get_non_targeted_action_id ( action_id  tgt_action_id)
static

Get the non targeted version of an action so it, if enabled, can appear in the target selection dialog.

Definition at line 144 of file action_dialog.c.

◆ get_production_targeted_action_id()

static action_id get_production_targeted_action_id ( action_id  tgt_action_id)
static

Get the production targeted version of an action so it, if enabled, can appear in the target selection dialog.

Definition at line 167 of file action_dialog.c.

◆ incite_dlg_window_callback()

static int incite_dlg_window_callback ( struct widget pwindow)
static

User interacted with Incite Revolt dialog window.

Definition at line 1569 of file action_dialog.c.

Referenced by popup_incite_dialog().

◆ popdown_bribe_dialog()

void popdown_bribe_dialog ( void  )

Popdown a dialog asking a diplomatic unit if it wishes to bribe the given enemy unit.

Definition at line 1891 of file action_dialog.c.

Referenced by diplomat_bribe_stack_yes_callback(), diplomat_bribe_unit_yes_callback(), and exit_bribe_dlg_callback().

◆ popdown_diplomat_dialog()

void popdown_diplomat_dialog ( void  )

◆ popdown_incite_dialog()

void popdown_incite_dialog ( void  )

Popdown a window asking a diplomatic unit if it wishes to incite the given enemy city.

Definition at line 1612 of file action_dialog.c.

Referenced by diplomat_incite_yes_callback(), and exit_incite_dlg_callback().

◆ popup_action_selection()

void popup_action_selection ( struct unit actor_unit,
struct city target_city,
struct unit target_unit,
struct tile target_tile,
struct extra_type target_extra,
const struct act_prob act_probs 
)

Popup a dialog that allows the player to select what action a unit should take.

Definition at line 959 of file action_dialog.c.

◆ popup_bribe_stack_dialog()

void popup_bribe_stack_dialog ( struct unit actor,
struct tile ptile,
int  cost,
const struct action paction 
)

Popup a dialog asking a diplomatic unit if it wishes to bribe the given enemy unit.

Definition at line 2074 of file action_dialog.c.

◆ popup_bribe_unit_dialog()

void popup_bribe_unit_dialog ( struct unit actor,
struct unit punit,
int  cost,
const struct action paction 
)

Popup a dialog asking a diplomatic unit if it wishes to bribe the given enemy unit.

Definition at line 1909 of file action_dialog.c.

◆ popup_incite_dialog()

void popup_incite_dialog ( struct unit actor,
struct city pcity,
int  cost,
const struct action paction 
)

Popup a window asking a diplomatic unit if it wishes to incite the given enemy city.

Definition at line 1630 of file action_dialog.c.

◆ popup_sabotage_dialog()

void popup_sabotage_dialog ( struct unit actor,
struct city pcity,
const struct action paction 
)

Pops-up the Spy sabotage dialog, upon return of list of available improvements requested by the above function.

Definition at line 1324 of file action_dialog.c.

◆ sabotage_impr_callback()

static int sabotage_impr_callback ( struct widget pwidget)
static

User selected what to sabotage.

Definition at line 1279 of file action_dialog.c.

Referenced by popup_sabotage_dialog().

◆ simple_action_callback()

static int simple_action_callback ( struct widget pwidget)
static

User selected an action from the choice dialog and the action has no special needs.

Definition at line 728 of file action_dialog.c.

◆ spy_incite_callback()

static int spy_incite_callback ( struct widget pwidget)
static

Ask the server how much the revolt is going to cost us

Definition at line 613 of file action_dialog.c.

◆ spy_sabotage_esc_request()

static int spy_sabotage_esc_request ( struct widget pwidget)
static

Requests up-to-date list of improvements, the return of which will trigger the popup_sabotage_dialog() function. (Escape version)

Definition at line 243 of file action_dialog.c.

◆ spy_sabotage_request()

static int spy_sabotage_request ( struct widget pwidget)
static

Requests up-to-date list of improvements, the return of which will trigger the popup_sabotage_dialog() function.

Definition at line 221 of file action_dialog.c.

◆ spy_steal_callback()

static int spy_steal_callback ( struct widget pwidget)
static

User selected which tech spy steals.

Definition at line 293 of file action_dialog.c.

Referenced by spy_steal_popup_shared().

◆ spy_steal_dlg_window_callback()

static int spy_steal_dlg_window_callback ( struct widget pwindow)
static

User interacted with spy's steal dialog window.

Definition at line 265 of file action_dialog.c.

Referenced by spy_steal_popup_shared().

◆ spy_steal_esc_popup()

static int spy_steal_esc_popup ( struct widget pwidget)
static

Popup spy tech stealing dialog for "Targeted Steal Tech Escape Expected".

Definition at line 582 of file action_dialog.c.

◆ spy_steal_popup()

static int spy_steal_popup ( struct widget pwidget)
static

Popup spy tech stealing dialog for "Targeted Steal Tech".

Definition at line 573 of file action_dialog.c.

◆ spy_steal_popup_shared()

static int spy_steal_popup_shared ( struct widget pwidget)
static

Popup spy tech stealing dialog.

Definition at line 329 of file action_dialog.c.

◆ spy_strike_bld_request()

static int spy_strike_bld_request ( struct widget pwidget)
static

Requests up-to-date list of improvements, the return of which will trigger the popup_sabotage_dialog() function.

Definition at line 200 of file action_dialog.c.

◆ upgrade_callback()

static int upgrade_callback ( struct widget pwidget)
static

User clicked "Upgrade Unit"

Definition at line 708 of file action_dialog.c.

Variable Documentation

◆ af_map

const act_func af_map[ACTION_COUNT]
static
Initial value:
= {
}
char * incite_cost
Definition comments.c:76
static void spy_steal_esc_popup(GtkWidget *w, gpointer data)
static void spy_steal_popup(GtkWidget *w, gpointer data)
static void found_city_callback(GtkWidget *w, gpointer data)
static void upgrade_callback(GtkWidget *w, gpointer data)
static int diplomat_bribe_unit_callback(struct widget *pwidget)
static int spy_sabotage_request(struct widget *pwidget)
static int diplomat_bribe_stack_callback(struct widget *pwidget)
static int spy_strike_bld_request(struct widget *pwidget)
static int spy_sabotage_esc_request(struct widget *pwidget)
static int spy_incite_callback(struct widget *pwidget)
static int diplomat_incite_callback(struct widget *pwidget)

Definition at line 863 of file action_dialog.c.

◆ bribe_dlg

struct small_diplomat_dialog* bribe_dlg = NULL
static

◆ did_not_decide

bool did_not_decide = FALSE
static

Definition at line 77 of file action_dialog.c.

◆ diplomat_dlg

struct diplomat_dialog* diplomat_dlg = NULL
static

◆ incite_dlg

struct small_diplomat_dialog* incite_dlg = NULL
static

◆ is_more_user_input_needed

bool is_more_user_input_needed = FALSE
static

Definition at line 76 of file action_dialog.c.

◆ is_unit_move_blocked

bool is_unit_move_blocked
extern