Freeciv-3.2
Loading...
Searching...
No Matches
Functions | Variables
mapctrl.c File Reference
#include <SDL3/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 "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 "pages.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_KeyboardEvent *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 2275 of file mapctrl.c.

◆ button_up_on_map()

void button_up_on_map ( struct mouse_button_behavior button_behavior)

Use released mouse button over map.

Definition at line 2346 of file mapctrl.c.

◆ cities_action_callback()

static int cities_action_callback ( struct widget button)
static

User interacted with cities button.

Definition at line 166 of file mapctrl.c.

◆ close_game_page()

void close_game_page ( void  )

Close game page.

Definition at line 2016 of file mapctrl.c.

◆ 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 2924 of file mapctrl.c.

◆ disable_main_widgets()

void disable_main_widgets ( void  )

Disable game page widgets.

Definition at line 2097 of file mapctrl.c.

◆ 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 2039 of file mapctrl.c.

◆ disable_minimap_window_buttons()

void disable_minimap_window_buttons ( void  )

Make minimap window buttons disabled.

Definition at line 1906 of file mapctrl.c.

◆ 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 2084 of file mapctrl.c.

◆ disable_unitinfo_window_buttons()

void disable_unitinfo_window_buttons ( void  )

Make unitinfo buttons disabled.

Definition at line 1613 of file mapctrl.c.

◆ economy_callback()

static int economy_callback ( struct widget button)
static

User interacted with Economy button.

Definition at line 243 of file mapctrl.c.

◆ enable_and_redraw_find_city_button()

void enable_and_redraw_find_city_button ( void  )

Make Find City button available.

Definition at line 2230 of file mapctrl.c.

◆ enable_and_redraw_revolution_button()

void enable_and_redraw_revolution_button ( void  )

Make Revolution button available.

Definition at line 2240 of file mapctrl.c.

◆ enable_main_widgets()

void enable_main_widgets ( void  )

Enable game page widgets.

Definition at line 2175 of file mapctrl.c.

◆ enable_minimap_widgets()

static void enable_minimap_widgets ( void  )
static

Make minimap window buttons enabled and redraw.

Definition at line 2112 of file mapctrl.c.

◆ enable_unitinfo_widgets()

static void enable_unitinfo_widgets ( void  )
static

Make unitinfo window buttons enabled and redraw.

Definition at line 2158 of file mapctrl.c.

◆ end_turn_callback()

static int end_turn_callback ( struct widget button)
static

User interacted with Turn Done button.

Definition at line 201 of file mapctrl.c.

◆ finger_down_on_map()

void finger_down_on_map ( struct finger_behavior finger_behavior)

Finger down handler

Definition at line 2249 of file mapctrl.c.

◆ finger_up_on_map()

void finger_up_on_map ( struct finger_behavior finger_behavior)

Finger up handler

Definition at line 2262 of file mapctrl.c.

◆ get_minimap_window_widget()

struct widget * get_minimap_window_widget ( void  )

Get main minimap widget.

Definition at line 2198 of file mapctrl.c.

◆ get_research_widget()

struct widget * get_research_widget ( void  )

Get main research widget.

Definition at line 2214 of file mapctrl.c.

◆ get_revolution_widget()

struct widget * get_revolution_widget ( void  )

Get main revolution widget.

Definition at line 2222 of file mapctrl.c.

◆ get_tax_rates_widget()

struct widget * get_tax_rates_widget ( void  )

Get main tax rates widget.

Definition at line 2206 of file mapctrl.c.

◆ get_unit_info_window_widget()

struct widget * get_unit_info_window_widget ( void  )

Get main unitinfo widget.

Definition at line 2190 of file mapctrl.c.

◆ hide_minimap_window_buttons()

void hide_minimap_window_buttons ( void  )

Make minimap window buttons hidden.

Definition at line 1831 of file mapctrl.c.

◆ hide_unitinfo_window_buttons()

void hide_unitinfo_window_buttons ( void  )

Make unitinfo buttons hidden.

Definition at line 1589 of file mapctrl.c.

◆ map_event_handler()

bool map_event_handler ( SDL_KeyboardEvent key)

Toggle map drawing stuff.

Definition at line 2440 of file mapctrl.c.

◆ minimap_window_callback()

static int minimap_window_callback ( struct widget pwidget)
static

User interacted with minimap window.

Definition at line 1258 of file mapctrl.c.

◆ 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 2742 of file mapctrl.c.

◆ 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 2721 of file mapctrl.c.

◆ 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 2681 of file mapctrl.c.

◆ 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 2699 of file mapctrl.c.

◆ players_action_callback()

static int players_action_callback ( struct widget pwidget)
static

User interacted with nations button.

Definition at line 119 of file mapctrl.c.

◆ popdown_minimap_window()

void popdown_minimap_window ( void  )

Close minimap window.

Definition at line 1940 of file mapctrl.c.

◆ popdown_newcity_dialog()

void popdown_newcity_dialog ( void  )

Close new city dialog.

Definition at line 2892 of file mapctrl.c.

◆ popdown_unitinfo_window()

void popdown_unitinfo_window ( void  )

Close unitinfo window.

Definition at line 1633 of file mapctrl.c.

◆ popup_minimap_window()

void popup_minimap_window ( void  )

Open minimap area.

Definition at line 1646 of file mapctrl.c.

◆ 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 2758 of file mapctrl.c.

◆ popup_unitinfo_window()

void popup_unitinfo_window ( void  )

Open unitinfo window.

Definition at line 1450 of file mapctrl.c.

◆ redraw_minimap_window_buttons()

void redraw_minimap_window_buttons ( void  )

Redraw minimap window buttons.

Definition at line 1869 of file mapctrl.c.

◆ research_callback()

static int research_callback ( struct widget button)
static

User interacted with Research button.

Definition at line 231 of file mapctrl.c.

◆ resize_minimap()

int resize_minimap ( void  )

Update the size of the minimap

Definition at line 550 of file mapctrl.c.

◆ revolution_callback()

static int revolution_callback ( struct widget button)
static

User interacted with Revolution button.

Definition at line 216 of file mapctrl.c.

◆ 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 1382 of file mapctrl.c.

◆ 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 1328 of file mapctrl.c.

◆ 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 2906 of file mapctrl.c.

◆ show_game_page()

void show_game_page ( void  )

Create and show game page.

Definition at line 1953 of file mapctrl.c.

◆ show_minimap_window_buttons()

void show_minimap_window_buttons ( void  )

Make minimap window buttons visible.

Definition at line 1793 of file mapctrl.c.

◆ show_unitinfo_window_buttons()

void show_unitinfo_window_buttons ( void  )

Make unitinfo buttons visible.

Definition at line 1565 of file mapctrl.c.

◆ toggle_map_window_callback()

static int toggle_map_window_callback ( struct widget map_button)
static

Show/Hide Mini Map

Definition at line 387 of file mapctrl.c.

◆ toggle_msg_window_callback()

static int toggle_msg_window_callback ( struct widget pwidget)
static

User interacted with messages toggling button.

Definition at line 525 of file mapctrl.c.

◆ 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 257 of file mapctrl.c.

◆ unit_info_window_callback()

static int unit_info_window_callback ( struct widget pwidget)
static

User interacted with unitinfo window.

Definition at line 1294 of file mapctrl.c.

◆ units_action_callback()

static int units_action_callback ( struct widget pwidget)
static

User interacted with units button.

Definition at line 151 of file mapctrl.c.

◆ 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 2937 of file mapctrl.c.

Variable Documentation

◆ draw_goto_patrol_lines

bool draw_goto_patrol_lines = FALSE

Definition at line 100 of file mapctrl.c.

Referenced by main_mouse_motion_handler(), and remove_net_input().

◆ find_city_button

struct widget* find_city_button = NULL
static

Definition at line 104 of file mapctrl.c.

◆ is_unit_move_blocked

bool is_unit_move_blocked
extern

Definition at line 107 of file gui_main.c.

Referenced by ui_main().

◆ minimap_dlg

struct advanced_dialog* minimap_dlg = NULL
static

Definition at line 92 of file mapctrl.c.

◆ minimap_window

struct widget* minimap_window = NULL
static

Definition at line 103 of file mapctrl.c.

◆ new_city_dlg

struct small_dialog* new_city_dlg = NULL
static

Definition at line 77 of file mapctrl.c.

◆ new_turn_button

struct widget* new_turn_button = NULL
static

Definition at line 101 of file mapctrl.c.

◆ options_button

struct widget* options_button
extern

Definition at line 103 of file optiondlg.c.

◆ overview_h

int overview_h = 0

Definition at line 96 of file mapctrl.c.

◆ overview_start_x

int overview_start_x
extern

Definition at line 73 of file mapview.c.

Referenced by refresh_overview().

◆ overview_start_y

int overview_start_y
extern

Definition at line 74 of file mapview.c.

Referenced by refresh_overview().

◆ overview_w

int overview_w = 0

Definition at line 95 of file mapctrl.c.

◆ research_button

struct widget* research_button = NULL
static

Definition at line 107 of file mapctrl.c.

◆ revolution_button

struct widget* revolution_button = NULL
static

Definition at line 105 of file mapctrl.c.

◆ suggested_city_name

char* suggested_city_name = NULL
static

Definition at line 76 of file mapctrl.c.

◆ tax_button

struct widget* tax_button = NULL
static

Definition at line 106 of file mapctrl.c.

◆ unit_info_dlg

struct advanced_dialog* unit_info_dlg = NULL
static

Definition at line 93 of file mapctrl.c.

◆ unitinfo_h

int unitinfo_h = 0

Definition at line 98 of file mapctrl.c.

◆ unitinfo_w

int unitinfo_w = 0

Definition at line 97 of file mapctrl.c.

◆ units_info_window

struct widget* units_info_window = NULL
static

Definition at line 102 of file mapctrl.c.