Freeciv-3.3
Loading...
Searching...
No Matches
Functions | Variables
mapctrl.c File Reference
#include <SDL2/SDL.h>
#include "fcintl.h"
#include "log.h"
#include "unit.h"
#include "unitlist.h"
#include "client_main.h"
#include "climisc.h"
#include "overview_common.h"
#include "pages_g.h"
#include "update_queue.h"
#include "zoom.h"
#include "citydlg.h"
#include "cityrep.h"
#include "colors.h"
#include "dialogs.h"
#include "finddlg.h"
#include "graphics.h"
#include "gui_id.h"
#include "gui_main.h"
#include "gui_mouse.h"
#include "gui_tilespec.h"
#include "mapview.h"
#include "menu.h"
#include "messagewin.h"
#include "optiondlg.h"
#include "plrdlg.h"
#include "repodlgs.h"
#include "sprite.h"
#include "themespec.h"
#include "widget.h"
#include "wldlg.h"
#include "mapctrl.h"

Go to the source code of this file.

Functions

static void enable_minimap_widgets (void)
 
static void disable_minimap_widgets (void)
 
static void enable_unitinfo_widgets (void)
 
static void disable_unitinfo_widgets (void)
 
static int players_action_callback (struct widget *pwidget)
 
static int units_action_callback (struct widget *pwidget)
 
static int cities_action_callback (struct widget *button)
 
static int end_turn_callback (struct widget *button)
 
static int revolution_callback (struct widget *button)
 
static int research_callback (struct widget *button)
 
static int economy_callback (struct widget *button)
 
static int toggle_unit_info_window_callback (struct widget *icon_widget)
 
static int toggle_map_window_callback (struct widget *map_button)
 
static int toggle_msg_window_callback (struct widget *pwidget)
 
int resize_minimap (void)
 
static int minimap_window_callback (struct widget *pwidget)
 
static int unit_info_window_callback (struct widget *pwidget)
 
void set_new_unitinfo_window_pos (void)
 
void set_new_minimap_window_pos (void)
 
void popup_unitinfo_window (void)
 
void show_unitinfo_window_buttons (void)
 
void hide_unitinfo_window_buttons (void)
 
void disable_unitinfo_window_buttons (void)
 
void popdown_unitinfo_window (void)
 
void popup_minimap_window (void)
 
void show_minimap_window_buttons (void)
 
void hide_minimap_window_buttons (void)
 
void redraw_minimap_window_buttons (void)
 
void disable_minimap_window_buttons (void)
 
void popdown_minimap_window (void)
 
void show_game_page (void)
 
void close_game_page (void)
 
void disable_main_widgets (void)
 
void enable_main_widgets (void)
 
struct widgetget_unit_info_window_widget (void)
 
struct widgetget_minimap_window_widget (void)
 
struct widgetget_tax_rates_widget (void)
 
struct widgetget_research_widget (void)
 
struct widgetget_revolution_widget (void)
 
void enable_and_redraw_find_city_button (void)
 
void enable_and_redraw_revolution_button (void)
 
void finger_down_on_map (struct finger_behavior *finger_behavior)
 
void finger_up_on_map (struct finger_behavior *finger_behavior)
 
void button_down_on_map (struct mouse_button_behavior *button_behavior)
 
void button_up_on_map (struct mouse_button_behavior *button_behavior)
 
bool map_event_handler (SDL_Keysym key)
 
static int newcity_name_edit_callback (struct widget *pedit)
 
static int newcity_ok_callback (struct widget *ok_button)
 
static int newcity_cancel_callback (struct widget *cancel_button)
 
static int move_new_city_dlg_callback (struct widget *pwindow)
 
void popup_newcity_dialog (struct unit *punit, const char *suggest_name)
 
void popdown_newcity_dialog (void)
 
void set_turn_done_button_state (bool state)
 
void create_line_at_mouse_pos (void)
 
void update_rect_at_mouse_pos (void)
 

Variables

int overview_start_x
 
int overview_start_y
 
bool is_unit_move_blocked
 
static charsuggested_city_name = NULL
 
static struct small_dialognew_city_dlg = NULL
 
struct widgetoptions_button
 
static struct advanced_dialogminimap_dlg = NULL
 
static struct advanced_dialogunit_info_dlg = NULL
 
int overview_w = 0
 
int overview_h = 0
 
int unitinfo_w = 0
 
int unitinfo_h = 0
 
bool draw_goto_patrol_lines = FALSE
 
static struct widgetnew_turn_button = NULL
 
static struct widgetunits_info_window = NULL
 
static struct widgetminimap_window = NULL
 
static struct widgetfind_city_button = NULL
 
static struct widgetrevolution_button = NULL
 
static struct widgettax_button = NULL
 
static struct widgetresearch_button = NULL
 

Function Documentation

◆ button_down_on_map()

void button_down_on_map ( struct mouse_button_behavior button_behavior)

Mouse click handler

Definition at line 2280 of file mapctrl.c.

Referenced by update_button_hold_state().

◆ button_up_on_map()

void button_up_on_map ( struct mouse_button_behavior button_behavior)

Use released mouse button over map.

Definition at line 2351 of file mapctrl.c.

Referenced by main_mouse_button_up_handler().

◆ cities_action_callback()

static int cities_action_callback ( struct widget button)
static

User interacted with cities button.

Definition at line 170 of file mapctrl.c.

Referenced by popup_minimap_window().

◆ close_game_page()

void close_game_page ( void  )

Close game page.

Definition at line 2021 of file mapctrl.c.

Referenced by real_set_client_page().

◆ create_line_at_mouse_pos()

void create_line_at_mouse_pos ( void  )

Draw a goto or patrol line at the current mouse position.

Definition at line 2929 of file mapctrl.c.

◆ disable_main_widgets()

void disable_main_widgets ( void  )

Disable game page widgets.

Definition at line 2102 of file mapctrl.c.

Referenced by popup_optiondlg().

◆ disable_minimap_widgets()

static void disable_minimap_widgets ( void  )
static

Make minimap window buttons disabled and redraw. TODO: Use disable_minimap_window_buttons() for disabling buttons.

Definition at line 2044 of file mapctrl.c.

Referenced by disable_main_widgets().

◆ disable_minimap_window_buttons()

void disable_minimap_window_buttons ( void  )

Make minimap window buttons disabled.

Definition at line 1911 of file mapctrl.c.

Referenced by real_menus_update().

◆ disable_unitinfo_widgets()

static void disable_unitinfo_widgets ( void  )
static

Make unitinfo window buttons disabled and redraw. TODO: Use disable_unitinfo_window_buttons() for disabling buttons.

Definition at line 2089 of file mapctrl.c.

Referenced by disable_main_widgets().

◆ disable_unitinfo_window_buttons()

void disable_unitinfo_window_buttons ( void  )

Make unitinfo buttons disabled.

Definition at line 1617 of file mapctrl.c.

Referenced by real_menus_update().

◆ economy_callback()

static int economy_callback ( struct widget button)
static

User interacted with Economy button.

Definition at line 247 of file mapctrl.c.

Referenced by popup_unitinfo_window().

◆ enable_and_redraw_find_city_button()

void enable_and_redraw_find_city_button ( void  )

Make Find City button available.

Definition at line 2235 of file mapctrl.c.

Referenced by city_report_dialog_popdown(), and popdown_find_dialog().

◆ enable_and_redraw_revolution_button()

void enable_and_redraw_revolution_button ( void  )

Make Revolution button available.

Definition at line 2245 of file mapctrl.c.

Referenced by popdown_government_dialog().

◆ enable_main_widgets()

void enable_main_widgets ( void  )

Enable game page widgets.

Definition at line 2180 of file mapctrl.c.

Referenced by popdown_optiondlg(), and real_set_client_page().

◆ enable_minimap_widgets()

static void enable_minimap_widgets ( void  )
static

Make minimap window buttons enabled and redraw.

Definition at line 2117 of file mapctrl.c.

Referenced by enable_main_widgets().

◆ enable_unitinfo_widgets()

static void enable_unitinfo_widgets ( void  )
static

Make unitinfo window buttons enabled and redraw.

Definition at line 2163 of file mapctrl.c.

Referenced by enable_main_widgets().

◆ end_turn_callback()

static int end_turn_callback ( struct widget button)
static

User interacted with Turn Done button.

Definition at line 205 of file mapctrl.c.

Referenced by popup_minimap_window().

◆ finger_down_on_map()

void finger_down_on_map ( struct finger_behavior finger_behavior)

Finger down handler

Definition at line 2254 of file mapctrl.c.

◆ finger_up_on_map()

void finger_up_on_map ( struct finger_behavior finger_behavior)

Finger up handler

Definition at line 2267 of file mapctrl.c.

Referenced by main_finger_up_handler().

◆ get_minimap_window_widget()

struct widget * get_minimap_window_widget ( void  )

◆ get_research_widget()

struct widget * get_research_widget ( void  )

◆ get_revolution_widget()

struct widget * get_revolution_widget ( void  )

Get main revolution widget.

Definition at line 2227 of file mapctrl.c.

Referenced by set_indicator_icons().

◆ get_tax_rates_widget()

struct widget * get_tax_rates_widget ( void  )

Get main tax rates widget.

Definition at line 2211 of file mapctrl.c.

Referenced by economy_report_dialog_popdown(), economy_report_dialog_popup(), exit_economy_dialog_callback(), and set_indicator_icons().

◆ get_unit_info_window_widget()

struct widget * get_unit_info_window_widget ( void  )

◆ hide_minimap_window_buttons()

void hide_minimap_window_buttons ( void  )

Make minimap window buttons hidden.

Definition at line 1836 of file mapctrl.c.

Referenced by real_menus_update().

◆ hide_unitinfo_window_buttons()

void hide_unitinfo_window_buttons ( void  )

Make unitinfo buttons hidden.

Definition at line 1593 of file mapctrl.c.

Referenced by real_menus_update().

◆ map_event_handler()

bool map_event_handler ( SDL_Keysym  key)

Toggle map drawing stuff.

Definition at line 2445 of file mapctrl.c.

Referenced by main_key_down_handler(), and main_key_down_handler().

◆ minimap_window_callback()

static int minimap_window_callback ( struct widget pwidget)
static

User interacted with minimap window.

Definition at line 1262 of file mapctrl.c.

Referenced by popup_minimap_window().

◆ move_new_city_dlg_callback()

static int move_new_city_dlg_callback ( struct widget pwindow)
static

User interacted with the new city dialog.

Definition at line 2747 of file mapctrl.c.

Referenced by popup_newcity_dialog().

◆ newcity_cancel_callback()

static int newcity_cancel_callback ( struct widget cancel_button)
static

User interacted with the Cancel button of the new city dialog.

Definition at line 2726 of file mapctrl.c.

Referenced by popup_newcity_dialog().

◆ newcity_name_edit_callback()

static int newcity_name_edit_callback ( struct widget pedit)
static

User interacted with the edit button of the new city dialog.

Definition at line 2686 of file mapctrl.c.

Referenced by popup_newcity_dialog().

◆ newcity_ok_callback()

static int newcity_ok_callback ( struct widget ok_button)
static

User interacted with the Ok button of the new city dialog.

Definition at line 2704 of file mapctrl.c.

Referenced by popup_newcity_dialog().

◆ players_action_callback()

static int players_action_callback ( struct widget pwidget)
static

User interacted with nations button.

Definition at line 123 of file mapctrl.c.

Referenced by popup_minimap_window().

◆ popdown_minimap_window()

void popdown_minimap_window ( void  )

Close minimap window.

Definition at line 1945 of file mapctrl.c.

Referenced by close_game_page(), and resize_minimap().

◆ popdown_newcity_dialog()

void popdown_newcity_dialog ( void  )

Close new city dialog.

Definition at line 2897 of file mapctrl.c.

Referenced by popdown_all_game_dialogs().

◆ popdown_unitinfo_window()

void popdown_unitinfo_window ( void  )

Close unitinfo window.

Definition at line 1637 of file mapctrl.c.

Referenced by close_game_page().

◆ popup_minimap_window()

void popup_minimap_window ( void  )

Open minimap area.

Definition at line 1650 of file mapctrl.c.

Referenced by resize_minimap(), and show_game_page().

◆ popup_newcity_dialog()

void popup_newcity_dialog ( struct unit punit,
const char suggest_name 
)

Popup a dialog to ask for the name of a new city. The given string should be used as a suggestion.

Definition at line 2763 of file mapctrl.c.

◆ popup_unitinfo_window()

void popup_unitinfo_window ( void  )

Open unitinfo window.

Definition at line 1454 of file mapctrl.c.

Referenced by show_game_page().

◆ redraw_minimap_window_buttons()

void redraw_minimap_window_buttons ( void  )

Redraw minimap window buttons.

Definition at line 1874 of file mapctrl.c.

Referenced by toggle_map_window_callback().

◆ research_callback()

static int research_callback ( struct widget button)
static

User interacted with Research button.

Definition at line 235 of file mapctrl.c.

Referenced by popup_unitinfo_window().

◆ resize_minimap()

int resize_minimap ( void  )

Update the size of the minimap

Definition at line 554 of file mapctrl.c.

Referenced by overview_size_changed().

◆ revolution_callback()

static int revolution_callback ( struct widget button)
static

User interacted with Revolution button.

Definition at line 220 of file mapctrl.c.

Referenced by popup_unitinfo_window().

◆ set_new_minimap_window_pos()

void set_new_minimap_window_pos ( void  )

This Function is used when resize main_data.screen. We must set new MiniMap start position.

Definition at line 1386 of file mapctrl.c.

Referenced by popup_minimap_window(), real_resize_window_callback(), and toggle_map_window_callback().

◆ set_new_unitinfo_window_pos()

void set_new_unitinfo_window_pos ( void  )

This Function is used when resize main_data.screen. We must set new Units Info Win. start position.

Definition at line 1332 of file mapctrl.c.

Referenced by popup_unitinfo_window(), real_resize_window_callback(), and toggle_unit_info_window_callback().

◆ set_turn_done_button_state()

void set_turn_done_button_state ( bool  state)

A turn done button should be provided for the player. This function is called to toggle it between active/inactive.

Definition at line 2911 of file mapctrl.c.

◆ show_game_page()

void show_game_page ( void  )

Create and show game page.

Definition at line 1958 of file mapctrl.c.

Referenced by real_set_client_page().

◆ show_minimap_window_buttons()

void show_minimap_window_buttons ( void  )

Make minimap window buttons visible.

Definition at line 1798 of file mapctrl.c.

Referenced by real_menus_update().

◆ show_unitinfo_window_buttons()

void show_unitinfo_window_buttons ( void  )

Make unitinfo buttons visible.

Definition at line 1569 of file mapctrl.c.

Referenced by real_menus_update().

◆ toggle_map_window_callback()

static int toggle_map_window_callback ( struct widget map_button)
static

Show/Hide Mini Map

Definition at line 391 of file mapctrl.c.

Referenced by popup_minimap_window().

◆ toggle_msg_window_callback()

static int toggle_msg_window_callback ( struct widget pwidget)
static

User interacted with messages toggling button.

Definition at line 529 of file mapctrl.c.

Referenced by popup_minimap_window().

◆ toggle_unit_info_window_callback()

static int toggle_unit_info_window_callback ( struct widget icon_widget)
static

Show/Hide Units Info Window

Definition at line 261 of file mapctrl.c.

Referenced by popup_unitinfo_window().

◆ unit_info_window_callback()

static int unit_info_window_callback ( struct widget pwidget)
static

User interacted with unitinfo window.

Definition at line 1298 of file mapctrl.c.

Referenced by popup_unitinfo_window().

◆ units_action_callback()

static int units_action_callback ( struct widget pwidget)
static

User interacted with units button.

Definition at line 155 of file mapctrl.c.

Referenced by popup_minimap_window().

◆ update_rect_at_mouse_pos()

void update_rect_at_mouse_pos ( void  )

The Area Selection rectangle. Called by center_tile_mapcanvas() and when the mouse pointer moves.

Definition at line 2942 of file mapctrl.c.

Variable Documentation

◆ draw_goto_patrol_lines

bool draw_goto_patrol_lines = FALSE

◆ find_city_button

struct widget* find_city_button = NULL
static

Definition at line 108 of file mapctrl.c.

Referenced by enable_and_redraw_find_city_button(), and popup_minimap_window().

◆ is_unit_move_blocked

bool is_unit_move_blocked
extern

Definition at line 108 of file gui_main.c.

Referenced by map_event_handler(), and map_event_handler().

◆ minimap_dlg

struct advanced_dialog* minimap_dlg = NULL
static

Definition at line 96 of file mapctrl.c.

Referenced by popdown_minimap_window(), and popup_minimap_window().

◆ minimap_window

struct widget* minimap_window = NULL
static

◆ new_city_dlg

struct small_dialog* new_city_dlg = NULL
static

◆ new_turn_button

struct widget* new_turn_button = NULL
static

Definition at line 105 of file mapctrl.c.

Referenced by popup_minimap_window(), and set_turn_done_button_state().

◆ options_button

struct widget* options_button
extern

Definition at line 103 of file optiondlg.c.

Referenced by close_game_page(), and popup_minimap_window().

◆ overview_h

int overview_h = 0

Definition at line 100 of file mapctrl.c.

Referenced by minimap_window_callback(), popup_minimap_window(), and resize_minimap().

◆ overview_start_x

int overview_start_x
extern

Definition at line 73 of file mapview.c.

Referenced by minimap_window_callback(), and resize_minimap().

◆ overview_start_y

int overview_start_y
extern

Definition at line 74 of file mapview.c.

Referenced by minimap_window_callback(), and resize_minimap().

◆ overview_w

int overview_w = 0

◆ research_button

struct widget* research_button = NULL
static

Definition at line 111 of file mapctrl.c.

Referenced by get_research_widget(), and popup_unitinfo_window().

◆ revolution_button

struct widget* revolution_button = NULL
static

◆ suggested_city_name

char* suggested_city_name = NULL
static

◆ tax_button

struct widget* tax_button = NULL
static

◆ unit_info_dlg

struct advanced_dialog* unit_info_dlg = NULL
static

Definition at line 97 of file mapctrl.c.

Referenced by popdown_unitinfo_window(), and popup_unitinfo_window().

◆ unitinfo_h

int unitinfo_h = 0

Definition at line 102 of file mapctrl.c.

Referenced by popup_unitinfo_window().

◆ unitinfo_w

int unitinfo_w = 0

Definition at line 101 of file mapctrl.c.

Referenced by popup_unitinfo_window().

◆ units_info_window

struct widget* units_info_window = NULL
static