Freeciv-3.3
Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
action_dialog.c File Reference
#include <gtk/gtk.h>
#include "astring.h"
#include "support.h"
#include "actions.h"
#include "game.h"
#include "traderoutes.h"
#include "movement.h"
#include "research.h"
#include "unit.h"
#include "unitlist.h"
#include "dialogs_g.h"
#include "chatline.h"
#include "choice_dialog.h"
#include "client_main.h"
#include "climisc.h"
#include "connectdlg_common.h"
#include "control.h"
#include "gui_main.h"
#include "gui_stuff.h"
#include "mapview.h"
#include "packhand.h"
#include "text.h"
#include "citydlg.h"
#include "dialogs.h"
#include "unitselextradlg.h"
#include "unitselunitdlg.h"
#include "wldlg.h"

Go to the source code of this file.

Data Structures

struct  action_data
 
struct  _FcActionRow
 
struct  _FcActionRowClass
 

Macros

#define BUTTON_NEW_UNIT_TGT   (ACTION_COUNT + 1)
 
#define BUTTON_NEW_EXTRA_TGT   (BUTTON_NEW_UNIT_TGT + 1)
 
#define BUTTON_LOCATION   (BUTTON_NEW_EXTRA_TGT + 1)
 
#define BUTTON_WAIT   (BUTTON_LOCATION + 1)
 
#define BUTTON_CANCEL   (BUTTON_WAIT + 1)
 
#define BUTTON_COUNT   (BUTTON_CANCEL + 1)
 
#define BUTTON_NOT_THERE   -1
 
#define FC_TYPE_ACTION_ROW   (fc_action_row_get_type())
 

Functions

static void fc_action_row_finalize (GObject *gobject)
 
static void fc_action_row_class_init (FcActionRowClass *klass)
 
static void fc_action_row_init (FcActionRow *self)
 
static FcActionRowfc_action_row_new (void)
 
static struct action_dataact_data (action_id act_id, int actor_id, int target_city_id, int target_unit_id, int target_tile_id, int target_building_id, int target_tech_id, int tgt_extra_id)
 
static void diplomat_queue_handle_primary (void)
 
static void diplomat_queue_handle_secondary (void)
 
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 void simple_action_callback (GtkWidget *w, gpointer data)
 
static void request_action_details_callback (GtkWidget *w, gpointer data)
 
static void found_city_callback (GtkWidget *w, gpointer data)
 
static void upgrade_callback (GtkWidget *w, gpointer data)
 
static void bribe_unit_response (GtkWidget *w, gint response, gpointer data)
 
static void bribe_stack_response (GtkWidget *w, gint response, gpointer data)
 
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)
 
static void spy_advances_response (GtkWidget *w, gint response, gpointer data)
 
static void spy_advances_callback (GtkSelectionModel *self, guint position, guint n_items, gpointer data)
 
static void action_factory_bind (GtkSignalListItemFactory *self, GtkListItem *list_item, gpointer user_data)
 
static void action_factory_setup (GtkSignalListItemFactory *self, GtkListItem *list_item, gpointer user_data)
 
static void create_advances_list (struct player *pplayer, struct player *pvictim, struct action_data *args)
 
static void spy_improvements_response (GtkWidget *w, gint response, gpointer data)
 
static void spy_improvements_callback (GtkSelectionModel *self, guint position, guint n_items, gpointer data)
 
static void create_improvements_list (struct player *pplayer, struct city *pcity, struct action_data *args)
 
static void spy_steal_popup_shared (GtkWidget *w, gpointer data)
 
static void spy_steal_popup (GtkWidget *w, gpointer data)
 
static void spy_steal_esc_popup (GtkWidget *w, gpointer data)
 
void popup_sabotage_dialog (struct unit *actor, struct city *pcity, const struct action *paction)
 
static void incite_response (GtkWidget *w, gint response, gpointer data)
 
void popup_incite_dialog (struct unit *actor, struct city *pcity, int cost, const struct action *paction)
 
static void tgt_unit_change_callback (GtkWidget *dlg, gint arg)
 
static void act_sel_new_unit_tgt_callback (GtkWidget *w, gpointer data)
 
static void tgt_extra_change_callback (GtkWidget *dlg, gint arg)
 
static void act_sel_new_extra_tgt_callback (GtkWidget *w, gpointer data)
 
static void act_sel_location_callback (GtkWidget *w, gpointer data)
 
static void act_sel_wait_callback (GtkWidget *w, gpointer data)
 
static void act_sel_destroy_callback (GtkWidget *w, gpointer data)
 
static void act_sel_cancel_callback (GtkWidget *w, gpointer data)
 
static void act_sel_close_callback (GtkWidget *w, gpointer data)
 
static void action_entry (GtkWidget *shl, action_id act_id, const struct act_prob *act_probs, const char *custom, action_id act_num)
 
static void action_entry_update (GtkWidget *shl, action_id act_id, const struct act_prob *act_probs, const char *custom, action_id act_num)
 
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)
 

Variables

static GtkWidgetact_sel_dialog
 
static int action_button_map [BUTTON_COUNT]
 
static int actor_unit_id
 
static int target_ids [ATK_COUNT]
 
static int target_extra_id
 
static bool is_more_user_input_needed = FALSE
 
static bool did_not_decide = FALSE
 
static bool action_selection_restart = FALSE
 
static GtkWidgetspy_tech_shell
 
static GtkWidgetspy_sabotage_shell
 
static struct action_dataact_sel_dialog_data
 
static const GCallback af_map [ACTION_COUNT]
 

Macro Definition Documentation

◆ BUTTON_CANCEL

#define BUTTON_CANCEL   (BUTTON_WAIT + 1)

Definition at line 59 of file action_dialog.c.

◆ BUTTON_COUNT

#define BUTTON_COUNT   (BUTTON_CANCEL + 1)

Definition at line 60 of file action_dialog.c.

◆ BUTTON_LOCATION

#define BUTTON_LOCATION   (BUTTON_NEW_EXTRA_TGT + 1)

Definition at line 57 of file action_dialog.c.

◆ BUTTON_NEW_EXTRA_TGT

#define BUTTON_NEW_EXTRA_TGT   (BUTTON_NEW_UNIT_TGT + 1)

Definition at line 56 of file action_dialog.c.

◆ BUTTON_NEW_UNIT_TGT

#define BUTTON_NEW_UNIT_TGT   (ACTION_COUNT + 1)

Definition at line 55 of file action_dialog.c.

◆ BUTTON_NOT_THERE

#define BUTTON_NOT_THERE   -1

Definition at line 62 of file action_dialog.c.

◆ BUTTON_WAIT

#define BUTTON_WAIT   (BUTTON_LOCATION + 1)

Definition at line 58 of file action_dialog.c.

◆ FC_TYPE_ACTION_ROW

#define FC_TYPE_ACTION_ROW   (fc_action_row_get_type())

Definition at line 95 of file action_dialog.c.

Function Documentation

◆ act_data()

static struct action_data * act_data ( action_id  act_id,
int  actor_id,
int  target_city_id,
int  target_unit_id,
int  target_tile_id,
int  target_building_id,
int  target_tech_id,
int  tgt_extra_id 
)
static

Create a new action data structure that can be stored in the dialogs.

Definition at line 163 of file action_dialog.c.

◆ act_sel_cancel_callback()

static void act_sel_cancel_callback ( GtkWidget w,
gpointer  data 
)
static

Action selection dialog has been canceled

Definition at line 1365 of file action_dialog.c.

◆ act_sel_close_callback()

static void act_sel_close_callback ( GtkWidget w,
gpointer  data 
)
static

Action selection dialog has been closed

Definition at line 1374 of file action_dialog.c.

◆ act_sel_destroy_callback()

static void act_sel_destroy_callback ( GtkWidget w,
gpointer  data 
)
static

Action selection dialog has been destroyed

Definition at line 1356 of file action_dialog.c.

◆ act_sel_location_callback()

static void act_sel_location_callback ( GtkWidget w,
gpointer  data 
)
static

Callback from action selection dialog for "Show Location".

Definition at line 1327 of file action_dialog.c.

◆ act_sel_new_extra_tgt_callback()

static void act_sel_new_extra_tgt_callback ( GtkWidget w,
gpointer  data 
)
static

Callback from action selection dialog for "Change extra target".

Definition at line 1272 of file action_dialog.c.

◆ act_sel_new_unit_tgt_callback()

static void act_sel_new_unit_tgt_callback ( GtkWidget w,
gpointer  data 
)
static

Callback from action selection dialog for "Change unit target".

Definition at line 1201 of file action_dialog.c.

◆ act_sel_wait_callback()

static void act_sel_wait_callback ( GtkWidget w,
gpointer  data 
)
static

Delay selection of what action to take.

Definition at line 1341 of file action_dialog.c.

◆ action_entry()

static void action_entry ( GtkWidget shl,
action_id  act_id,
const struct act_prob act_probs,
const char custom,
action_id  act_num 
)
static

Show the user the action if it is enabled.

Definition at line 1411 of file action_dialog.c.

◆ action_entry_update()

static void action_entry_update ( GtkWidget shl,
action_id  act_id,
const struct act_prob act_probs,
const char custom,
action_id  act_num 
)
static

Update an existing button.

Definition at line 1449 of file action_dialog.c.

◆ action_factory_bind()

static void action_factory_bind ( GtkSignalListItemFactory self,
GtkListItem list_item,
gpointer  user_data 
)
static

Action table cell bind function

Definition at line 695 of file action_dialog.c.

Referenced by create_advances_list(), and create_improvements_list().

◆ action_factory_setup()

static void action_factory_setup ( GtkSignalListItemFactory self,
GtkListItem list_item,
gpointer  user_data 
)
static

Action table cell setup function

Definition at line 710 of file action_dialog.c.

Referenced by create_advances_list(), and create_improvements_list().

◆ 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 1725 of file action_dialog.c.

◆ action_selection_close()

void action_selection_close ( void  )

Closes the action selection dialog

Definition at line 1874 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 250 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 1795 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 1739 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 1783 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 1768 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 1753 of file action_dialog.c.

◆ bribe_stack_response()

static void bribe_stack_response ( GtkWidget w,
gint  response,
gpointer  data 
)
static

User responded to bribe stack dialog

Definition at line 540 of file action_dialog.c.

◆ bribe_unit_response()

static void bribe_unit_response ( GtkWidget w,
gint  response,
gpointer  data 
)
static

User responded to bribe unit dialog

Definition at line 521 of file action_dialog.c.

◆ create_advances_list()

static void create_advances_list ( struct player pplayer,
struct player pvictim,
struct action_data args 
)
static

Create spy's tech stealing dialog

Definition at line 720 of file action_dialog.c.

◆ create_improvements_list()

static void create_improvements_list ( struct player pplayer,
struct city pcity,
struct action_data args 
)
static

Creates spy's building sabotaging dialog

Definition at line 904 of file action_dialog.c.

◆ diplomat_queue_handle_primary()

static void diplomat_queue_handle_primary ( void  )
static

Move the queue of units that need user input forward unless the current unit is going to need more input.

Definition at line 190 of file action_dialog.c.

◆ diplomat_queue_handle_secondary()

static void diplomat_queue_handle_secondary ( void  )
static

Move the queue of units that need user input forward since the current unit doesn't require the extra input any more.

Definition at line 237 of file action_dialog.c.

◆ fc_action_row_class_init()

static void fc_action_row_class_init ( FcActionRowClass klass)
static

Initialization method for FcActionRow class

Definition at line 131 of file action_dialog.c.

◆ fc_action_row_finalize()

static void fc_action_row_finalize ( GObject gobject)
static

Finalizing method for FcActionRow

Definition at line 117 of file action_dialog.c.

Referenced by fc_action_row_class_init().

◆ fc_action_row_init()

static void fc_action_row_init ( FcActionRow self)
static

Initialization method for FcActionRow

Definition at line 142 of file action_dialog.c.

◆ fc_action_row_new()

static FcActionRow * fc_action_row_new ( void  )
static

FcActionRow creation method

Definition at line 150 of file action_dialog.c.

Referenced by create_advances_list(), and create_improvements_list().

◆ found_city_callback()

static void found_city_callback ( GtkWidget w,
gpointer  data 
)
static

User selected build city from the choice dialog

Definition at line 485 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 260 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 283 of file action_dialog.c.

◆ incite_response()

static void incite_response ( GtkWidget w,
gint  response,
gpointer  data 
)
static

User has responded to incite dialog

Definition at line 1092 of file action_dialog.c.

◆ 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 1483 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 stack bribe dialog

Definition at line 598 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 unit bribe dialog

Definition at line 559 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 the yes/no dialog for inciting, since we know the cost now

Definition at line 1111 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 1076 of file action_dialog.c.

◆ request_action_details_callback()

static void request_action_details_callback ( GtkWidget w,
gpointer  data 
)
static

User selected an action from the choice dialog that needs details from the server.

Definition at line 411 of file action_dialog.c.

◆ simple_action_callback()

static void simple_action_callback ( GtkWidget w,
gpointer  data 
)
static

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

Definition at line 304 of file action_dialog.c.

◆ spy_advances_callback()

static void spy_advances_callback ( GtkSelectionModel self,
guint  position,
guint  n_items,
gpointer  data 
)
static

User selected entry in steal advances dialog

Definition at line 670 of file action_dialog.c.

◆ spy_advances_response()

static void spy_advances_response ( GtkWidget w,
gint  response,
gpointer  data 
)
static

User responded to steal advances dialog

Definition at line 637 of file action_dialog.c.

◆ spy_improvements_callback()

static void spy_improvements_callback ( GtkSelectionModel self,
guint  position,
guint  n_items,
gpointer  data 
)
static

User has selected new building from spy's sabotage dialog

Definition at line 879 of file action_dialog.c.

◆ spy_improvements_response()

static void spy_improvements_response ( GtkWidget w,
gint  response,
gpointer  data 
)
static

User has responded to spy's sabotage building dialog

Definition at line 839 of file action_dialog.c.

◆ spy_steal_esc_popup()

static void spy_steal_esc_popup ( GtkWidget w,
gpointer  data 
)
static

Popup tech stealing dialog with list of possible techs for "Targeted Steal Tech Escape Expected"

Definition at line 1066 of file action_dialog.c.

◆ spy_steal_popup()

static void spy_steal_popup ( GtkWidget w,
gpointer  data 
)
static

Popup tech stealing dialog with list of possible techs for "Targeted Steal Tech"

Definition at line 1056 of file action_dialog.c.

◆ spy_steal_popup_shared()

static void spy_steal_popup_shared ( GtkWidget w,
gpointer  data 
)
static

Popup tech stealing dialog with list of possible techs

Definition at line 1020 of file action_dialog.c.

◆ tgt_extra_change_callback()

static void tgt_extra_change_callback ( GtkWidget dlg,
gint  arg 
)
static

Callback from the extra target selection dialog.

Definition at line 1229 of file action_dialog.c.

◆ tgt_unit_change_callback()

static void tgt_unit_change_callback ( GtkWidget dlg,
gint  arg 
)
static

Callback from the unit target selection dialog.

Definition at line 1158 of file action_dialog.c.

◆ upgrade_callback()

static void upgrade_callback ( GtkWidget w,
gpointer  data 
)
static

User selected "Upgrade Unit" from choice dialog.

Definition at line 499 of file action_dialog.c.

Variable Documentation

◆ act_sel_dialog

GtkWidget* act_sel_dialog
static

Definition at line 65 of file action_dialog.c.

◆ act_sel_dialog_data

struct action_data* act_sel_dialog_data
static

Definition at line 93 of file action_dialog.c.

◆ action_button_map

int action_button_map[BUTTON_COUNT]
static

Definition at line 66 of file action_dialog.c.

◆ action_selection_restart

bool action_selection_restart = FALSE
static

Definition at line 73 of file action_dialog.c.

◆ actor_unit_id

int actor_unit_id
static

Definition at line 68 of file action_dialog.c.

◆ af_map

const GCallback af_map[ACTION_COUNT]
static

◆ did_not_decide

bool did_not_decide = FALSE
static

Definition at line 72 of file action_dialog.c.

◆ is_more_user_input_needed

bool is_more_user_input_needed = FALSE
static

Definition at line 71 of file action_dialog.c.

◆ spy_sabotage_shell

GtkWidget* spy_sabotage_shell
static

Definition at line 77 of file action_dialog.c.

◆ spy_tech_shell

GtkWidget* spy_tech_shell
static

Definition at line 75 of file action_dialog.c.

◆ target_extra_id

int target_extra_id
static

Definition at line 70 of file action_dialog.c.

◆ target_ids

int target_ids[ATK_COUNT]
static

Definition at line 69 of file action_dialog.c.