Freeciv-3.3
Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions | Variables
citydlg.c File Reference
#include <SDL2/SDL.h>
#include "astring.h"
#include "bitvector.h"
#include "fcintl.h"
#include "log.h"
#include "game.h"
#include "movement.h"
#include "specialist.h"
#include "unitlist.h"
#include "client_main.h"
#include "climisc.h"
#include "control.h"
#include "text.h"
#include "cityrep.h"
#include "cma_fe.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 "menu.h"
#include "sprite.h"
#include "themespec.h"
#include "widget.h"
#include "wldlg.h"
#include "citydlg.h"

Go to the source code of this file.

Data Structures

struct  city_dialog
 

Enumerations

enum  specialist_type { SP_ELVIS , SP_SCIENTIST , SP_TAXMAN , SP_LAST }
 

Functions

static void popdown_hurry_production_dialog (void)
 
static void disable_city_dlg_widgets (void)
 
static void redraw_city_dialog (struct city *pcity)
 
static void rebuild_imprm_list (struct city *pcity)
 
static void rebuild_citydlg_title_str (struct widget *pwindow, struct city *pcity)
 
struct impr_typeget_building_for_effect (enum effect_type effect_type)
 
static void popdown_city_menu_dlg (bool enable_city_dialog_widgets)
 
static void del_city_dialog (void)
 
static int city_dlg_callback (struct widget *pwindow)
 
static int cancel_units_orders_city_dlg_callback (struct widget *button)
 
static int activate_units_orders_city_dlg_callback (struct widget *button)
 
static int activate_and_exit_units_orders_city_dlg_callback (struct widget *button)
 
static int sentry_units_orders_city_dlg_callback (struct widget *button)
 
static int fortify_units_orders_city_dlg_callback (struct widget *button)
 
static int disband_units_orders_city_dlg_callback (struct widget *button)
 
static int homecity_units_orders_city_dlg_callback (struct widget *button)
 
static int upgrade_units_orders_city_dlg_callback (struct widget *button)
 
static int units_orders_dlg_callback (struct widget *button)
 
static int units_orders_city_dlg_callback (struct widget *button)
 
static SDL_Surfacecreate_unit_surface (struct unit *punit, bool support, int w, int h)
 
static void create_present_supported_units_widget_list (struct unit_list *units)
 
void free_city_units_lists (void)
 
static int army_city_dlg_callback (struct widget *button)
 
static int supported_unit_city_dlg_callback (struct widget *button)
 
static int info_city_dlg_callback (struct widget *button)
 
static int happy_city_dlg_callback (struct widget *button)
 
static int misc_panel_city_dlg_callback (struct widget *pwidget)
 
static void create_city_options_widget_list (struct city *pcity)
 
static int options_city_dlg_callback (struct widget *button)
 
static int cma_city_dlg_callback (struct widget *button)
 
static int exit_city_dlg_callback (struct widget *button)
 
static int cancel_buy_prod_city_dlg_callback (struct widget *button)
 
static int ok_buy_prod_city_dlg_callback (struct widget *button)
 
static int buy_prod_city_dlg_callback (struct widget *button)
 
static int hurry_production_window_callback (struct widget *pwindow)
 
void popup_hurry_production_dialog (struct city *pcity, SDL_Surface *pdest)
 
static int change_prod_dlg_callback (struct widget *button)
 
static int sell_imprvm_dlg_cancel_callback (struct widget *cancel_button)
 
static int sell_imprvm_dlg_ok_callback (struct widget *ok_button)
 
static int sell_imprvm_dlg_callback (struct widget *impr)
 
void enable_city_dlg_widgets (void)
 
SDL_Surfaceget_scaled_city_map (struct city *pcity)
 
static int resource_map_city_dlg_callback (struct widget *map)
 
static int city_comp_by_turn_founded (const void *a, const void *b)
 
static int next_prev_city_dlg_callback (struct widget *button)
 
static int new_name_city_dlg_callback (struct widget *pedit)
 
static void refresh_city_names (struct city *pcity)
 
static void redraw_misc_city_dialog (struct widget *city_window, struct city *pcity)
 
static void redraw_supported_units_city_dialog (struct widget *city_window, struct city *pcity)
 
static void redraw_army_city_dialog (struct widget *city_window, struct city *pcity)
 
static void redraw_info_city_dialog (struct widget *city_window, struct city *pcity)
 
static void redraw_happiness_city_dialog (const struct widget *city_window, struct city *pcity)
 
void real_city_dialog_popup (struct city *pcity)
 
void popdown_city_dialog (struct city *pcity)
 
void popdown_all_city_dialogs (void)
 
void real_city_dialog_refresh (struct city *pcity)
 
void refresh_unit_city_dialogs (struct unit *punit)
 
bool city_dialog_is_open (struct city *pcity)
 

Variables

static struct city_dialogpcity_dlg = NULL
 
static float city_map_zoom = 1
 
static struct small_dialoghurry_prog_dlg = NULL
 

Enumeration Type Documentation

◆ specialist_type

Enumerator
SP_ELVIS 
SP_SCIENTIST 
SP_TAXMAN 
SP_LAST 

Definition at line 109 of file citydlg.c.

Function Documentation

◆ activate_and_exit_units_orders_city_dlg_callback()

static int activate_and_exit_units_orders_city_dlg_callback ( struct widget button)
static

Activate unit and popdow city dlg. + center on unit.

Definition at line 274 of file citydlg.c.

Referenced by units_orders_city_dlg_callback().

◆ activate_units_orders_city_dlg_callback()

static int activate_units_orders_city_dlg_callback ( struct widget button)
static

Activate unit and del unit order dlg. widget group.

Definition at line 257 of file citydlg.c.

Referenced by units_orders_city_dlg_callback().

◆ army_city_dlg_callback()

static int army_city_dlg_callback ( struct widget button)
static

Change to present units panel.

Definition at line 832 of file citydlg.c.

Referenced by real_city_dialog_popup().

◆ buy_prod_city_dlg_callback()

static int buy_prod_city_dlg_callback ( struct widget button)
static

Popup buy productions dlg.

Definition at line 1136 of file citydlg.c.

Referenced by real_city_dialog_popup().

◆ cancel_buy_prod_city_dlg_callback()

static int cancel_buy_prod_city_dlg_callback ( struct widget button)
static

Popdown buy productions dlg.

Definition at line 1093 of file citydlg.c.

Referenced by popup_hurry_production_dialog().

◆ cancel_units_orders_city_dlg_callback()

static int cancel_units_orders_city_dlg_callback ( struct widget button)
static

Popdown unit city orders menu.

Definition at line 239 of file citydlg.c.

Referenced by units_orders_city_dlg_callback().

◆ change_prod_dlg_callback()

static int change_prod_dlg_callback ( struct widget button)
static

Popup the change production dialog.

Definition at line 1353 of file citydlg.c.

Referenced by real_city_dialog_popup().

◆ city_comp_by_turn_founded()

static int city_comp_by_turn_founded ( const void a,
const void b 
)
static

Helper for switch_city_callback.

Definition at line 1658 of file citydlg.c.

Referenced by next_prev_city_dlg_callback().

◆ city_dialog_is_open()

bool city_dialog_is_open ( struct city pcity)

Return whether the dialog for the given city is open.

Definition at line 3863 of file citydlg.c.

◆ city_dlg_callback()

static int city_dlg_callback ( struct widget pwindow)
static

Main City Dlg. window callback. This implements specialist change ( Elvis, Taxman, Scientist )

Definition at line 199 of file citydlg.c.

Referenced by real_city_dialog_popup().

◆ cma_city_dlg_callback()

static int cma_city_dlg_callback ( struct widget button)
static

User interacted with Citizen Governor button.

Definition at line 1064 of file citydlg.c.

Referenced by real_city_dialog_popup().

◆ create_city_options_widget_list()

static void create_city_options_widget_list ( struct city pcity)
static

Create city options widgets.

Definition at line 977 of file citydlg.c.

Referenced by redraw_misc_city_dialog().

◆ create_present_supported_units_widget_list()

static void create_present_supported_units_widget_list ( struct unit_list *  units)
static

Create present/supported units widget list 207 pixels is panel width in city dlg. 220 - max y position pixel position belong to panel area.

Definition at line 706 of file citydlg.c.

Referenced by redraw_army_city_dialog(), and redraw_supported_units_city_dialog().

◆ create_unit_surface()

static SDL_Surface * create_unit_surface ( struct unit punit,
bool  support,
int  w,
int  h 
)
static

Create unit icon with support icons.

Definition at line 619 of file citydlg.c.

Referenced by create_present_supported_units_widget_list().

◆ del_city_dialog()

static void del_city_dialog ( void  )
static

Destroy City Dlg

Definition at line 162 of file citydlg.c.

Referenced by popdown_city_dialog().

◆ disable_city_dlg_widgets()

static void disable_city_dlg_widgets ( void  )
static

◆ disband_units_orders_city_dlg_callback()

static int disband_units_orders_city_dlg_callback ( struct widget button)
static

Disband unit and del unit order dlg. widget group.

Definition at line 331 of file citydlg.c.

Referenced by units_orders_city_dlg_callback().

◆ enable_city_dlg_widgets()

void enable_city_dlg_widgets ( void  )

◆ exit_city_dlg_callback()

static int exit_city_dlg_callback ( struct widget button)
static

Exit city dialog.

Definition at line 1077 of file citydlg.c.

Referenced by real_city_dialog_popup().

◆ fortify_units_orders_city_dlg_callback()

static int fortify_units_orders_city_dlg_callback ( struct widget button)
static

Fortify unit and del unit order dlg. widget group.

Definition at line 314 of file citydlg.c.

Referenced by units_orders_city_dlg_callback().

◆ free_city_units_lists()

void free_city_units_lists ( void  )

◆ get_building_for_effect()

struct impr_type * get_building_for_effect ( enum effect_type effect_type effect_type  )

Return first building that has given effect.

FIXME: Some callers would work better if they got building actually provides the effect at the moment, and not just first potential one.

Definition at line 132 of file citydlg.c.

◆ get_scaled_city_map()

SDL_Surface * get_scaled_city_map ( struct city pcity)

Return scaled city map.

Definition at line 1620 of file citydlg.c.

Referenced by next_prev_city_dlg_callback(), popup_city_cma_dialog(), real_city_dialog_popup(), and redraw_city_dialog().

◆ happy_city_dlg_callback()

static int happy_city_dlg_callback ( struct widget button)
static

Change to happines panel.

Definition at line 895 of file citydlg.c.

Referenced by real_city_dialog_popup().

◆ homecity_units_orders_city_dlg_callback()

static int homecity_units_orders_city_dlg_callback ( struct widget button)
static

Homecity unit and del unit order dlg. widget group.

Definition at line 346 of file citydlg.c.

Referenced by units_orders_city_dlg_callback().

◆ hurry_production_window_callback()

static int hurry_production_window_callback ( struct widget pwindow)
static

Main hurry productions dlg. callback

Definition at line 1164 of file citydlg.c.

Referenced by popup_hurry_production_dialog().

◆ info_city_dlg_callback()

static int info_city_dlg_callback ( struct widget button)
static

Change to info panel.

Definition at line 874 of file citydlg.c.

Referenced by real_city_dialog_popup().

◆ misc_panel_city_dlg_callback()

static int misc_panel_city_dlg_callback ( struct widget pwidget)
static

City option callback

Definition at line 915 of file citydlg.c.

Referenced by create_city_options_widget_list().

◆ new_name_city_dlg_callback()

static int new_name_city_dlg_callback ( struct widget pedit)
static

New city name given for renaming it.

Definition at line 1743 of file citydlg.c.

Referenced by real_city_dialog_popup().

◆ next_prev_city_dlg_callback()

static int next_prev_city_dlg_callback ( struct widget button)
static

Callback for next/prev city button

Definition at line 1669 of file citydlg.c.

Referenced by real_city_dialog_popup().

◆ ok_buy_prod_city_dlg_callback()

static int ok_buy_prod_city_dlg_callback ( struct widget button)
static

Buy productions.

Definition at line 1110 of file citydlg.c.

Referenced by popup_hurry_production_dialog().

◆ options_city_dlg_callback()

static int options_city_dlg_callback ( struct widget button)
static

Change to city options panel.

Definition at line 1042 of file citydlg.c.

Referenced by real_city_dialog_popup().

◆ popdown_all_city_dialogs()

void popdown_all_city_dialogs ( void  )

Close all cities dialogs.

Definition at line 3824 of file citydlg.c.

◆ popdown_city_dialog()

void popdown_city_dialog ( struct city pcity)

Close the dialog for the given city.

Definition at line 3809 of file citydlg.c.

◆ popdown_city_menu_dlg()

static void popdown_city_menu_dlg ( bool  enable_city_dialog_widgets)
static

◆ popdown_hurry_production_dialog()

static void popdown_hurry_production_dialog ( void  )
static

Popup buy productions dlg.

Definition at line 1151 of file citydlg.c.

Referenced by cancel_buy_prod_city_dlg_callback(), and ok_buy_prod_city_dlg_callback().

◆ popup_hurry_production_dialog()

void popup_hurry_production_dialog ( struct city pcity,
SDL_Surface pdest 
)

◆ real_city_dialog_popup()

void real_city_dialog_popup ( struct city pcity)

Pop up (or bring to the front) a dialog for the given city. It may or may not be modal.

Definition at line 3553 of file citydlg.c.

◆ real_city_dialog_refresh()

void real_city_dialog_refresh ( struct city pcity)

Refresh (update) all data for the given city's dialog.

Definition at line 3834 of file citydlg.c.

◆ rebuild_citydlg_title_str()

static void rebuild_citydlg_title_str ( struct widget pwindow,
struct city pcity 
)
static

Recreate citydialog title.

Definition at line 3513 of file citydlg.c.

Referenced by real_city_dialog_popup(), redraw_city_dialog(), and refresh_city_names().

◆ rebuild_imprm_list()

static void rebuild_imprm_list ( struct city pcity)
static

Recreate improvement list for city dialog.

Definition at line 3422 of file citydlg.c.

Referenced by next_prev_city_dlg_callback(), and real_city_dialog_popup().

◆ redraw_army_city_dialog()

static void redraw_army_city_dialog ( struct widget city_window,
struct city pcity 
)
static

Redraw garrison panel 207 = max panel width

Definition at line 1880 of file citydlg.c.

Referenced by redraw_city_dialog().

◆ redraw_city_dialog()

static void redraw_city_dialog ( struct city pcity)
static

◆ redraw_happiness_city_dialog()

static void redraw_happiness_city_dialog ( const struct widget city_window,
struct city pcity 
)
static

Redraw (refresh/update) the happiness info for the dialog 207 - max panel width 180 - max citizens icons area width

Definition at line 2103 of file citydlg.c.

Referenced by redraw_city_dialog().

◆ redraw_info_city_dialog()

static void redraw_info_city_dialog ( struct widget city_window,
struct city pcity 
)
static

Redraw Info panel 207 = max panel width

Definition at line 1937 of file citydlg.c.

Referenced by redraw_city_dialog().

◆ redraw_misc_city_dialog()

static void redraw_misc_city_dialog ( struct widget city_window,
struct city pcity 
)
static

Redraw city option panel 207 = max panel width

Definition at line 1788 of file citydlg.c.

Referenced by redraw_city_dialog().

◆ redraw_supported_units_city_dialog()

static void redraw_supported_units_city_dialog ( struct widget city_window,
struct city pcity 
)
static

Redraw supported unit panel 207 = max panel width

Definition at line 1823 of file citydlg.c.

Referenced by redraw_city_dialog().

◆ refresh_city_names()

static void refresh_city_names ( struct city pcity)
static

Refresh (update) the city names for the dialog

Definition at line 1768 of file citydlg.c.

Referenced by redraw_city_dialog().

◆ refresh_unit_city_dialogs()

void refresh_unit_city_dialogs ( struct unit punit)

Update city dialogs when the given unit's status changes. This typically means updating both the unit's home city (if any) and the city in which it is present (if any).

Definition at line 3847 of file citydlg.c.

◆ resource_map_city_dlg_callback()

static int resource_map_city_dlg_callback ( struct widget map)
static

City resource map: event callback

Definition at line 1634 of file citydlg.c.

Referenced by real_city_dialog_popup().

◆ sell_imprvm_dlg_callback()

static int sell_imprvm_dlg_callback ( struct widget impr)
static

Popup Sell Imprvm. Dlg.

Definition at line 1424 of file citydlg.c.

Referenced by rebuild_imprm_list().

◆ sell_imprvm_dlg_cancel_callback()

static int sell_imprvm_dlg_cancel_callback ( struct widget cancel_button)
static

Popdown Sell Imprv. Dlg. and exit without sell.

Definition at line 1373 of file citydlg.c.

Referenced by sell_imprvm_dlg_callback().

◆ sell_imprvm_dlg_ok_callback()

static int sell_imprvm_dlg_ok_callback ( struct widget ok_button)
static

Popdown Sell Imprv. Dlg. and exit with sell.

Definition at line 1390 of file citydlg.c.

Referenced by sell_imprvm_dlg_callback().

◆ sentry_units_orders_city_dlg_callback()

static int sentry_units_orders_city_dlg_callback ( struct widget button)
static

Sentry unit and del unit order dlg. widget group.

Definition at line 297 of file citydlg.c.

Referenced by units_orders_city_dlg_callback().

◆ supported_unit_city_dlg_callback()

static int supported_unit_city_dlg_callback ( struct widget button)
static

Change to supported units panel.

Definition at line 852 of file citydlg.c.

Referenced by real_city_dialog_popup().

◆ units_orders_city_dlg_callback()

static int units_orders_city_dlg_callback ( struct widget button)
static

Popup units orders menu.

Definition at line 386 of file citydlg.c.

Referenced by create_present_supported_units_widget_list().

◆ units_orders_dlg_callback()

static int units_orders_dlg_callback ( struct widget button)
static

Main unit order dlg. callback.

Definition at line 378 of file citydlg.c.

Referenced by units_orders_city_dlg_callback().

◆ upgrade_units_orders_city_dlg_callback()

static int upgrade_units_orders_city_dlg_callback ( struct widget button)
static

Upgrade unit and del unit order dlg. widget group.

Definition at line 363 of file citydlg.c.

Referenced by units_orders_city_dlg_callback().

Variable Documentation

◆ city_map_zoom

float city_map_zoom = 1
static

Definition at line 113 of file citydlg.c.

Referenced by get_scaled_city_map(), and resource_map_city_dlg_callback().

◆ hurry_prog_dlg

struct small_dialog* hurry_prog_dlg = NULL
static

◆ pcity_dlg

struct city_dialog * pcity_dlg = NULL
static