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

Freeciv-3.1

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_type * | get_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_Surface * | create_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_Surface * | get_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_dialog * | pcity_dlg = NULL
static float | city_map_zoom = 1
static struct small_dialog * | hurry_prog_dlg = NULL

## Enumeration Type Documentation

## ◆ specialist_type

enum 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 831 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 1135 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 1092 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 1352 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 1657 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 3862 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 1063 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 705 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

Disable all city dialog widgets

Definition at line 1597 of file citydlg.c.

Referenced by buy_prod_city_dlg_callback(), change_prod_dlg_callback(), cma_city_dlg_callback(), sell_imprvm_dlg_callback(), and units_orders_city_dlg_callback().

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

Enable city dialog widgets that can be enabled.

Definition at line 1534 of file citydlg.c.

Referenced by cancel_buy_prod_city_dlg_callback(), cancel_disband_unit_callback(), cancel_units_orders_city_dlg_callback(), cancel_upgrade_unit_callback(), ok_buy_prod_city_dlg_callback(), ok_disband_unit_window_callback(), ok_upgrade_unit_window_callback(), popdown_city_cma_dialog(), popdown_city_menu_dlg(), popdown_worklist_editor(), sell_imprvm_dlg_cancel_callback(), and sell_imprvm_dlg_ok_callback().

## ◆ exit_city_dlg_callback()

static int exit_city_dlg_callback | ( | struct widget * | button | ) |

static

Exit city dialog.

Definition at line 1076 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 |  | ) |

Free city present/supported units panel list.

Definition at line 818 of file citydlg.c.

Referenced by army_city_dlg_callback(), del_city_dialog(), happy_city_dlg_callback(), info_city_dlg_callback(), next_prev_city_dlg_callback(), ok_disband_unit_window_callback(), ok_upgrade_unit_window_callback(), options_city_dlg_callback(), refresh_unit_city_dialogs(), and supported_unit_city_dlg_callback().

## ◆ 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 1619 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 894 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 1163 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 873 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 914 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 1742 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 1668 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 1109 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 1041 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 3823 of file citydlg.c.

## ◆ popdown_city_dialog()

void popdown_city_dialog | ( | struct city * | pcity | ) |

Close the dialog for the given city.

Definition at line 3808 of file citydlg.c.

## ◆ popdown_city_menu_dlg()

static void popdown_city_menu_dlg | ( | bool | enable_city_dialog_widgets | ) |

static

Destroy City Menu Dlg but not undraw.

Definition at line 146 of file citydlg.c.

Referenced by activate_units_orders_city_dlg_callback(), del_city_dialog(), disband_units_orders_city_dlg_callback(), fortify_units_orders_city_dlg_callback(), homecity_units_orders_city_dlg_callback(), sentry_units_orders_city_dlg_callback(), and upgrade_units_orders_city_dlg_callback().

## ◆ popdown_hurry_production_dialog()

static void popdown_hurry_production_dialog | ( | void |  | ) |

static

Popup buy productions dlg.

Definition at line 1150 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
| ) |  |

Popup buy production dlg.

Definition at line 1175 of file citydlg.c.

Referenced by button_up_on_map(), buy_prod_city_dlg_callback(), hurry_production_callback(), and popup_buy_production_from_city_report_callback().

## ◆ 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 3552 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 3833 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 3512 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 3421 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 1879 of file citydlg.c.

Referenced by redraw_city_dialog().

## ◆ redraw_city_dialog()

static void redraw_city_dialog | ( | struct city * | pcity | ) |

static

Redraw the dialog.

Definition at line 2433 of file citydlg.c.

Referenced by army_city_dlg_callback(), happy_city_dlg_callback(), info_city_dlg_callback(), next_prev_city_dlg_callback(), options_city_dlg_callback(), real_city_dialog_popup(), real_city_dialog_refresh(), refresh_unit_city_dialogs(), sell_imprvm_dlg_cancel_callback(), sell_imprvm_dlg_ok_callback(), and supported_unit_city_dlg_callback().

## ◆ 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 2102 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 1936 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 1787 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 1822 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 1767 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 3846 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 1633 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 1423 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 1372 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 1389 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 851 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

Definition at line 115 of file citydlg.c.

Referenced by del_city_dialog(), hurry_production_window_callback(), popdown_hurry_production_dialog(), and popup_hurry_production_dialog().

## ◆ pcity_dlg

struct city_dialog * pcity_dlg = NULL

static

Referenced by activate_and_exit_units_orders_city_dlg_callback(), army_city_dlg_callback(), buy_prod_city_dlg_callback(), cancel_buy_prod_city_dlg_callback(), cancel_units_orders_city_dlg_callback(), change_prod_dlg_callback(), city_dialog_is_open(), city_dlg_callback(), cma_city_dlg_callback(), create_city_options_widget_list(), create_present_supported_units_widget_list(), create_unit_surface(), del_city_dialog(), disable_city_dlg_widgets(), enable_city_dlg_widgets(), exit_city_dlg_callback(), free_city_units_lists(), happy_city_dlg_callback(), info_city_dlg_callback(), misc_panel_city_dlg_callback(), new_name_city_dlg_callback(), next_prev_city_dlg_callback(), ok_buy_prod_city_dlg_callback(), options_city_dlg_callback(), popdown_all_city_dialogs(), popdown_city_menu_dlg(), popup_hurry_production_dialog(), real_city_dialog_popup(), real_city_dialog_refresh(), rebuild_imprm_list(), redraw_army_city_dialog(), redraw_city_dialog(), redraw_misc_city_dialog(), redraw_supported_units_city_dialog(), refresh_city_names(), refresh_unit_city_dialogs(), resource_map_city_dlg_callback(), sell_imprvm_dlg_callback(), sell_imprvm_dlg_cancel_callback(), sell_imprvm_dlg_ok_callback(), supported_unit_city_dlg_callback(), and units_orders_city_dlg_callback().