Freeciv-3.3: /fast/freeciv/nightly/main/client/gui-sdl3/action_dialog.c File Reference

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_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_yes_callback (struct widget *pwidget)
static int | exit_bribe_dlg_callback (struct widget *pwidget)
void | popup_bribe_dialog (struct unit *actor, struct unit *punit, int cost, const struct action *paction)

## Variables

bool | is_unit_move_blocked
static struct diplomat_dialog * | diplomat_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_dialog * | incite_dlg = NULL
static struct small_diplomat_dialog * | bribe_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.

## ◆ act_sel_done_secondary()

static void act_sel_done_secondary | ( | int | actor_unit_id | ) |

static

A follow up question about the selected action is done.

Definition at line 121 of file action_dialog.c.

## ◆ 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 871 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 1158 of file action_dialog.c.

## ◆ action_selection_close()

void action_selection_close | ( | void |  | ) |

Closes the action selection dialog

Definition at line 1247 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 1230 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 1173 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 1218 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 1203 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 1188 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 1814 of file action_dialog.c.

## ◆ diplomat_bribe_callback()

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

static

Ask the server how much the bribe costs

Definition at line 650 of file action_dialog.c.

## ◆ diplomat_bribe_yes_callback()

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

static

User confirmed bribe.

Definition at line 1826 of file action_dialog.c.

## ◆ diplomat_close_callback()

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

static

Close diplomat dialog.

Definition at line 813 of file action_dialog.c.

## ◆ 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.

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

## ◆ exit_bribe_dlg_callback()

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

static

Close bribe dialog.

Definition at line 1843 of file action_dialog.c.

## ◆ exit_incite_dlg_callback()

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

static

Close incite dialog.

Definition at line 1580 of file action_dialog.c.

## ◆ 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.

## ◆ found_city_callback()

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

static

User clicked "Found City"

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

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

Referenced by popdown_all_game_dialogs().

## ◆ popdown_diplomat_dialog()

void popdown_diplomat_dialog | ( | void |  | ) |

Popdown a dialog giving a diplomatic unit some options when moving into the target tile.

Definition at line 826 of file action_dialog.c.

Referenced by popdown_all_game_dialogs().

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

Referenced by popdown_all_game_dialogs().

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

## ◆ popup_bribe_dialog()

void popup_bribe_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 1874 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 1611 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 1305 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 1260 of file action_dialog.c.

## ◆ 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 708 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.

## ◆ 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.

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

## Variable Documentation

## ◆ af_map

const act_func af_map[ACTION_COUNT]

static

Initial value:
= {
[ACTION_SPY_TARGETED_SABOTAGE_CITY] = spy_sabotage_request,
[ACTION_SPY_TARGETED_SABOTAGE_CITY_ESC] = spy_sabotage_esc_request,
[ACTION_SPY_TARGETED_STEAL_TECH] = spy_steal_popup,
[ACTION_SPY_TARGETED_STEAL_TECH_ESC] = spy_steal_esc_popup,
[ACTION_SPY_INCITE_CITY] = diplomat_incite_callback,
[ACTION_SPY_INCITE_CITY_ESC] = spy_incite_callback,
[ACTION_UPGRADE_UNIT] = upgrade_callback,
[ACTION_STRIKE_BUILDING] = spy_strike_bld_request,
[ACTION_SPY_BRIBE_UNIT] = diplomat_bribe_callback,
[ACTION_FOUND_CITY] = found_city_callback,
}
incite_cost
char * incite_cost
Definition comments.c:74
spy_steal_esc_popup
static void spy_steal_esc_popup(GtkWidget *w, gpointer data)
Definition action_dialog.c:921
spy_steal_popup
static void spy_steal_popup(GtkWidget *w, gpointer data)
Definition action_dialog.c:911
found_city_callback
static void found_city_callback(GtkWidget *w, gpointer data)
Definition action_dialog.c:421
upgrade_callback
static void upgrade_callback(GtkWidget *w, gpointer data)
Definition action_dialog.c:435
spy_sabotage_request
static int spy_sabotage_request(struct widget *pwidget)
Definition action_dialog.c:221
spy_strike_bld_request
static int spy_strike_bld_request(struct widget *pwidget)
Definition action_dialog.c:200
spy_sabotage_esc_request
static int spy_sabotage_esc_request(struct widget *pwidget)
Definition action_dialog.c:243
spy_incite_callback
static int spy_incite_callback(struct widget *pwidget)
Definition action_dialog.c:613
diplomat_bribe_callback
static int diplomat_bribe_callback(struct widget *pwidget)
Definition action_dialog.c:650
diplomat_incite_callback
static int diplomat_incite_callback(struct widget *pwidget)
Definition action_dialog.c:591

Definition at line 843 of file action_dialog.c.

## ◆ bribe_dlg

struct small_diplomat_dialog* bribe_dlg = NULL

static

Definition at line 1809 of file action_dialog.c.

## ◆ 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

Definition at line 75 of file action_dialog.c.

## ◆ incite_dlg

struct small_diplomat_dialog* incite_dlg = NULL

static

Definition at line 1545 of file action_dialog.c.

## ◆ 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

Definition at line 107 of file gui_main.c.