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

Freeciv-3.3

Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions | Variables
citydlg.c File Reference
`#include <SDL3/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 105 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 270 of file citydlg.c.

## ◆ 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 253 of file citydlg.c.

## ◆ army_city_dlg_callback()

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

static

Change to present units panel.

Definition at line 827 of file citydlg.c.

## ◆ buy_prod_city_dlg_callback()

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

static

Popup buy productions dlg.

Definition at line 1129 of file citydlg.c.

## ◆ 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 1086 of file citydlg.c.

## ◆ 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 235 of file citydlg.c.

## ◆ change_prod_dlg_callback()

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

static

Popup the change production dialog.

Definition at line 1346 of file citydlg.c.

## ◆ 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 1651 of file citydlg.c.

## ◆ 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 3856 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 195 of file citydlg.c.

## ◆ cma_city_dlg_callback()

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

static

User interacted with Citizen Governor button.

Definition at line 1057 of file citydlg.c.

## ◆ create_city_options_widget_list()

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

static

Create city options widgets.

Definition at line 971 of file citydlg.c.

## ◆ 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 701 of file citydlg.c.

## ◆ 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 615 of file citydlg.c.

## ◆ del_city_dialog()

static void del_city_dialog | ( | void |  | ) |

static

Destroy City Dlg

Definition at line 158 of file citydlg.c.

## ◆ disable_city_dlg_widgets()

static void disable_city_dlg_widgets | ( | void |  | ) |

static

Disable all city dialog widgets

Definition at line 1591 of file citydlg.c.

## ◆ 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 327 of file citydlg.c.

## ◆ enable_city_dlg_widgets()

void enable_city_dlg_widgets | ( | void |  | ) |

Enable city dialog widgets that can be enabled.

Definition at line 1528 of file citydlg.c.

## ◆ exit_city_dlg_callback()

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

static

Exit city dialog.

Definition at line 1070 of file citydlg.c.

## ◆ 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 310 of file citydlg.c.

## ◆ free_city_units_lists()

void free_city_units_lists | ( | void |  | ) |

Free city present/supported units panel list.

Definition at line 814 of file citydlg.c.

## ◆ 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 128 of file citydlg.c.

## ◆ get_scaled_city_map()

SDL_Surface * get_scaled_city_map | ( | struct city * | pcity | ) |

Return scaled city map.

Definition at line 1613 of file citydlg.c.

## ◆ happy_city_dlg_callback()

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

static

Change to happines panel.

Definition at line 890 of file citydlg.c.

## ◆ 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 342 of file citydlg.c.

## ◆ hurry_production_window_callback()

static int hurry_production_window_callback | ( | struct widget * | pwindow | ) |

static

Main hurry productions dlg. callback

Definition at line 1157 of file citydlg.c.

## ◆ info_city_dlg_callback()

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

static

Change to info panel.

Definition at line 869 of file citydlg.c.

## ◆ misc_panel_city_dlg_callback()

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

static

City option callback

Definition at line 910 of file citydlg.c.

## ◆ 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 1736 of file citydlg.c.

## ◆ 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 1662 of file citydlg.c.

## ◆ ok_buy_prod_city_dlg_callback()

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

static

Buy productions.

Definition at line 1103 of file citydlg.c.

## ◆ options_city_dlg_callback()

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

static

Change to city options panel.

Definition at line 1035 of file citydlg.c.

## ◆ popdown_all_city_dialogs()

void popdown_all_city_dialogs | ( | void |  | ) |

Close all cities dialogs.

Definition at line 3817 of file citydlg.c.

## ◆ popdown_city_dialog()

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

Close the dialog for the given city.

Definition at line 3802 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 142 of file citydlg.c.

## ◆ popdown_hurry_production_dialog()

static void popdown_hurry_production_dialog | ( | void |  | ) |

static

Popup buy productions dlg.

Definition at line 1144 of file citydlg.c.

## ◆ popup_hurry_production_dialog()

void popup_hurry_production_dialog | ( | struct city * | pcity,
|  | SDL_Surface * | pdest
| ) |  |

Popup buy production dlg.

Definition at line 1169 of file citydlg.c.

## ◆ 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 3546 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 3827 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 3506 of file citydlg.c.

## ◆ rebuild_imprm_list()

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

static

Recreate improvement list for city dialog.

Definition at line 3415 of file citydlg.c.

## ◆ 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 1873 of file citydlg.c.

## ◆ redraw_city_dialog()

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

static

Redraw the dialog.

Definition at line 2427 of file citydlg.c.

## ◆ 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 2096 of file citydlg.c.

## ◆ 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 1930 of file citydlg.c.

## ◆ 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 1781 of file citydlg.c.

## ◆ 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 1816 of file citydlg.c.

## ◆ refresh_city_names()

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

static

Refresh (update) the city names for the dialog

Definition at line 1761 of file citydlg.c.

## ◆ 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 3840 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 1627 of file citydlg.c.

## ◆ sell_imprvm_dlg_callback()

static int sell_imprvm_dlg_callback | ( | struct widget * | impr | ) |

static

Popup Sell Imprvm. Dlg.

Definition at line 1417 of file citydlg.c.

## ◆ 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 1366 of file citydlg.c.

## ◆ 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 1383 of file citydlg.c.

## ◆ 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 293 of file citydlg.c.

## ◆ supported_unit_city_dlg_callback()

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

static

Change to supported units panel.

Definition at line 847 of file citydlg.c.

## ◆ units_orders_city_dlg_callback()

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

static

Popup units orders menu.

Definition at line 382 of file citydlg.c.

## ◆ units_orders_dlg_callback()

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

static

Main unit order dlg. callback.

Definition at line 374 of file citydlg.c.

## ◆ 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 359 of file citydlg.c.

## Variable Documentation

## ◆ city_map_zoom

float city_map_zoom = 1

static

Definition at line 109 of file citydlg.c.

## ◆ hurry_prog_dlg

struct small_dialog* hurry_prog_dlg = NULL

static

Definition at line 111 of file citydlg.c.

## ◆ pcity_dlg

struct city_dialog * pcity_dlg = NULL

static