Freeciv-3.2
Loading...
Searching...
No Matches
Functions | Variables
mapview.c File Reference
#include <SDL3/SDL.h>
#include "astring.h"
#include "bugs.h"
#include "fcintl.h"
#include "log.h"
#include "calendar.h"
#include "game.h"
#include "goto.h"
#include "government.h"
#include "movement.h"
#include "research.h"
#include "unitlist.h"
#include "citydlg_common.h"
#include "client_main.h"
#include "climisc.h"
#include "overview_common.h"
#include "pages_g.h"
#include "text.h"
#include "colors.h"
#include "dialogs.h"
#include "graphics.h"
#include "gui_id.h"
#include "gui_main.h"
#include "gui_mouse.h"
#include "gui_tilespec.h"
#include "mapctrl.h"
#include "sprite.h"
#include "themespec.h"
#include "widget.h"
#include "mapview.h"

Go to the source code of this file.

Functions

void update_map_canvas_scrollbars_size (void)
 
static void flush_mapcanvas (int canvas_x, int canvas_y, int pixel_width, int pixel_height)
 
void flush_rect (SDL_Rect *rect, bool force_flush)
 
void unqueue_flush (void)
 
void queue_flush (void)
 
void dirty_rect (int canvas_x, int canvas_y, int pixel_width, int pixel_height)
 
void dirty_sdl_rect (SDL_Rect *Rect)
 
void dirty_all (void)
 
void flush_all (void)
 
void flush_dirty (void)
 
void gui_flush (void)
 
void set_indicator_icons (struct sprite *bulb, struct sprite *sol, struct sprite *flake, struct sprite *gov)
 
void overview_size_changed (void)
 
void update_info_label (void)
 
static int focus_units_info_callback (struct widget *pwidget)
 
void redraw_unit_info_label (struct unit_list *punitlist)
 
static bool is_focus_anim_enabled (void)
 
void set_unit_icon (int idx, struct unit *punit)
 
void set_unit_icons_more_arrow (bool onoff)
 
void real_focus_units_changed (void)
 
void update_unit_info_label (struct unit_list *punitlist)
 
void update_timeout_label (void)
 
void update_turn_done_button (bool do_restore)
 
void update_city_descriptions (void)
 
struct canvasget_overview_window (void)
 
void get_overview_area_dimensions (int *width, int *height)
 
void refresh_overview (void)
 
void update_map_canvas_scrollbars (void)
 
void put_cross_overlay_tile (struct tile *ptile)
 
void draw_selection_rectangle (int canvas_x, int canvas_y, int w, int h)
 
void tileset_changed (void)
 
void city_map_canvas_free (void)
 
SDL_Surfacecreate_city_map (struct city *pcity)
 
SDL_Surfaceget_terrain_surface (struct tile *ptile)
 
void update_overview_scroll_window_pos (int x, int y)
 
void start_turn (void)
 
void map_canvas_size_refresh (void)
 

Variables

SDL_Rectinfo_area
 
int overview_start_x = 0
 
int overview_start_y = 0
 
static struct canvasoverview_canvas
 
static struct canvascity_map_canvas = NULL
 
static struct canvasterrain_canvas
 
static bool is_flush_queued = FALSE
 

Function Documentation

◆ city_map_canvas_free()

void city_map_canvas_free ( void  )

Free memory allocated for the city map canvas

Definition at line 1186 of file mapview.c.

◆ create_city_map()

SDL_Surface * create_city_map ( struct city pcity)

Create new city map surface.

Definition at line 1197 of file mapview.c.

◆ dirty_all()

void dirty_all ( void  )

Select entire screen area to "end" flush and block "save" new areas.

Definition at line 188 of file mapview.c.

◆ dirty_rect()

void dirty_rect ( int  canvas_x,
int  canvas_y,
int  pixel_width,
int  pixel_height 
)

Save Flush area used by "end" flush.

Definition at line 166 of file mapview.c.

◆ dirty_sdl_rect()

void dirty_sdl_rect ( SDL_Rect Rect)

Save Flush rect used by "end" flush.

Definition at line 177 of file mapview.c.

◆ draw_selection_rectangle()

void draw_selection_rectangle ( int  canvas_x,
int  canvas_y,
int  w,
int  h 
)

Area Selection

Definition at line 1160 of file mapview.c.

◆ flush_all()

void flush_all ( void  )

flush entire screen.

Definition at line 197 of file mapview.c.

◆ flush_dirty()

void flush_dirty ( void  )

Make "end" Flush "saved" parts/areas of the buffer(s) to the screen. Function is called in handle_procesing_finished and handle_thaw_hint

Definition at line 208 of file mapview.c.

◆ flush_mapcanvas()

static void flush_mapcanvas ( int  canvas_x,
int  canvas_y,
int  pixel_width,
int  pixel_height 
)
static

Flush the mapcanvas part of the buffer(s) to the screen.

Definition at line 88 of file mapview.c.

◆ flush_rect()

void flush_rect ( SDL_Rect rect,
bool  force_flush 
)

Flush the given part of the buffer(s) to the screen.

Definition at line 99 of file mapview.c.

◆ focus_units_info_callback()

static int focus_units_info_callback ( struct widget pwidget)
static

User interacted with the focus units widget.

Definition at line 500 of file mapview.c.

◆ get_overview_area_dimensions()

void get_overview_area_dimensions ( int width,
int height 
)

Return the dimensions of the area (container widget; maximum size) for the overview.

Definition at line 1088 of file mapview.c.

◆ get_overview_window()

struct canvas * get_overview_window ( void  )

Return a canvas that is the overview window.

Definition at line 1079 of file mapview.c.

◆ get_terrain_surface()

SDL_Surface * get_terrain_surface ( struct tile ptile)

Return surface containing terrain of the tile.

Definition at line 1213 of file mapview.c.

◆ gui_flush()

void gui_flush ( void  )

This function is called when the map has changed.

Definition at line 283 of file mapview.c.

◆ is_focus_anim_enabled()

static bool is_focus_anim_enabled ( void  )
static

Is the focus animation enabled?

Definition at line 975 of file mapview.c.

◆ map_canvas_size_refresh()

void map_canvas_size_refresh ( void  )

Refresh map canvas size information

Definition at line 1246 of file mapview.c.

◆ overview_size_changed()

void overview_size_changed ( void  )

Called when the map size changes. This may be used to change the size of the GUI element holding the overview canvas. The overview.width and overview.height are updated if this function is called.

Definition at line 379 of file mapview.c.

◆ put_cross_overlay_tile()

void put_cross_overlay_tile ( struct tile ptile)

Draw a cross-hair overlay on a tile.

Definition at line 1152 of file mapview.c.

◆ queue_flush()

void queue_flush ( void  )

Called when a region is marked dirty, this function queues a flush event to be handled later by SDL. The flush may end up being done by freeciv before then, in which case it will be a wasted call.

Definition at line 148 of file mapview.c.

◆ real_focus_units_changed()

void real_focus_units_changed ( void  )

Called when the set of units in focus (get_units_in_focus()) changes. Standard updates like update_unit_info_label() are handled in the platform- independent code, so some clients will not need to do anything here.

Definition at line 1007 of file mapview.c.

◆ redraw_unit_info_label()

void redraw_unit_info_label ( struct unit_list *  punitlist)

Read Function Name :) FIXME: should use same method as client/text.c popup_info_text()

Definition at line 518 of file mapview.c.

◆ refresh_overview()

void refresh_overview ( void  )

Refresh (update) the viewrect on the overview. This is the rectangle showing the area covered by the mapview.

Definition at line 1120 of file mapview.c.

◆ set_indicator_icons()

void set_indicator_icons ( struct sprite bulb,
struct sprite sol,
struct sprite flake,
struct sprite gov 
)

Set information for the indicator icons typically shown in the main client window. The parameters tell which sprite to use for the indicator.

Definition at line 297 of file mapview.c.

◆ set_unit_icon()

void set_unit_icon ( int  idx,
struct unit punit 
)

Set one of the unit icons in the information area based on punit. NULL will be passed to clear the icon. idx == -1 will be passed to indicate this is the active unit, or idx in [0..num_units_below - 1] for secondary (inactive) units on the same tile.

Definition at line 986 of file mapview.c.

◆ set_unit_icons_more_arrow()

void set_unit_icons_more_arrow ( bool  onoff)

Most clients use an arrow (e.g., sprites.right_arrow) to indicate when the units_below will not fit. This function is called to activate and deactivate the arrow.

Definition at line 997 of file mapview.c.

◆ start_turn()

void start_turn ( void  )

New turn callback

Definition at line 1240 of file mapview.c.

◆ tileset_changed()

void tileset_changed ( void  )

This function is called when the tileset is changed.

Definition at line 1171 of file mapview.c.

◆ unqueue_flush()

void unqueue_flush ( void  )

A callback invoked as a result of a FLUSH event, this function simply flushes the mapview canvas.

Definition at line 136 of file mapview.c.

◆ update_city_descriptions()

void update_city_descriptions ( void  )

Update (refresh) all of the city descriptions on the mapview.

Definition at line 1065 of file mapview.c.

◆ update_info_label()

void update_info_label ( void  )

Typically an info box is provided to tell the player about the state of their civilization. This function is called when the label is changed.

Definition at line 397 of file mapview.c.

◆ update_map_canvas_scrollbars()

void update_map_canvas_scrollbars ( void  )

Update (refresh) the locations of the mapview scrollbars (if it uses them).

Definition at line 1144 of file mapview.c.

◆ update_map_canvas_scrollbars_size()

void update_map_canvas_scrollbars_size ( void  )

Refresh map canvas scrollbar as canvas size changes

Update the size of the sliders on the scrollbars.

Definition at line 78 of file mapview.c.

◆ update_overview_scroll_window_pos()

void update_overview_scroll_window_pos ( int  x,
int  y 
)

Sets the position of the overview scroll window based on mapview position.

Definition at line 1232 of file mapview.c.

◆ update_timeout_label()

void update_timeout_label ( void  )

Refresh timeout label.

Definition at line 1045 of file mapview.c.

◆ update_turn_done_button()

void update_turn_done_button ( bool  do_restore)

Refresh turn done button.

Definition at line 1053 of file mapview.c.

◆ update_unit_info_label()

void update_unit_info_label ( struct unit_list *  punitlist)

Update the information label which gives info on the current unit and the square under the current unit, for specified unit. Note that in practice punit is always the focus unit.

Clears label if punitlist is NULL or empty.

Typically also updates the cursor for the map_canvas (this is related because the info label may includes "select destination" prompt etc). And it may call update_unit_pix_label() to update the icons for units on this square.

Definition at line 1024 of file mapview.c.

Variable Documentation

◆ city_map_canvas

Definition at line 73 of file mapview.c.

◆ info_area

SDL_Rect* info_area
extern

◆ is_flush_queued

bool is_flush_queued = FALSE
static

Definition at line 83 of file mapview.c.

◆ overview_canvas

struct canvas* overview_canvas
static

Definition at line 72 of file mapview.c.

◆ overview_start_x

int overview_start_x = 0

Definition at line 69 of file mapview.c.

Referenced by minimap_window_callback(), and resize_minimap().

◆ overview_start_y

int overview_start_y = 0

Definition at line 70 of file mapview.c.

Referenced by minimap_window_callback(), and resize_minimap().

◆ terrain_canvas

struct canvas* terrain_canvas
static

Definition at line 74 of file mapview.c.