Freeciv-3.3
Loading...
Searching...
No Matches
Functions | Variables
overview_common.c File Reference
#include <math.h>
#include "log.h"
#include "client_main.h"
#include "climap.h"
#include "control.h"
#include "mapview_g.h"
#include "options.h"
#include "zoom.h"
#include "overview_common.h"

Go to the source code of this file.

Functions

static void gui_to_natural_pos (const struct tileset *t, double *ntl_x, double *ntl_y, int gui_x, int gui_y)
 
static void gui_to_overview_pos (const struct tileset *t, int *ovr_x, int *ovr_y, int gui_x, int gui_y)
 
static struct coloroverview_tile_color (struct tile *ptile)
 
void refresh_overview_from_canvas (void)
 
static void redraw_overview (void)
 
static void dirty_overview (void)
 
void flush_dirty_overview (void)
 
static double wrap_double (double value, double wrap)
 
void center_tile_overviewcanvas (void)
 
void map_to_overview_pos (int *overview_x, int *overview_y, int map_x, int map_y)
 
void overview_to_map_pos (int *map_x, int *map_y, int overview_x, int overview_y)
 
void refresh_overview_canvas (void)
 
static void put_overview_tile_area (struct canvas *pcanvas, struct tile *ptile, int x, int y, int w, int h)
 
void overview_update_tile (struct tile *ptile)
 
void calculate_overview_dimensions (void)
 
void overview_free (void)
 
void overview_redraw_callback (struct option *option)
 

Variables

int OVERVIEW_TILE_SIZE = 2
 
static bool overview_dirty = FALSE
 

Function Documentation

◆ calculate_overview_dimensions()

void calculate_overview_dimensions ( void  )

Called if the map size is know or changes.

Definition at line 450 of file overview_common.c.

Referenced by handle_map_info().

◆ center_tile_overviewcanvas()

void center_tile_overviewcanvas ( void  )

Center the overview around the mapview.

Definition at line 287 of file overview_common.c.

Referenced by base_set_mapview_origin(), and map_canvas_resized().

◆ dirty_overview()

static void dirty_overview ( void  )
static

Mark the overview as "dirty" so that it will be redrawn soon.

Definition at line 253 of file overview_common.c.

Referenced by overview_update_tile().

◆ flush_dirty_overview()

void flush_dirty_overview ( void  )

Redraw the overview if it is "dirty".

Definition at line 261 of file overview_common.c.

Referenced by unqueue_mapview_updates().

◆ gui_to_natural_pos()

static void gui_to_natural_pos ( const struct tileset t,
double ntl_x,
double ntl_y,
int  gui_x,
int  gui_y 
)
static

Translate from gui to natural coordinate systems. This provides natural coordinates as a floating-point value so there is no loss of information in the resulting values.

Definition at line 56 of file overview_common.c.

Referenced by center_tile_overviewcanvas(), and gui_to_overview_pos().

◆ gui_to_overview_pos()

static void gui_to_overview_pos ( const struct tileset t,
int ovr_x,
int ovr_y,
int  gui_x,
int  gui_y 
)
static

Translate from gui to overview coordinate systems.

Definition at line 84 of file overview_common.c.

Referenced by center_tile_overviewcanvas(), and redraw_overview().

◆ map_to_overview_pos()

void map_to_overview_pos ( int overview_x,
int overview_y,
int  map_x,
int  map_y 
)

Finds the overview (canvas) coordinates for a given map position.

Definition at line 324 of file overview_common.c.

◆ overview_free()

void overview_free ( void  )

Free overview resources.

Definition at line 511 of file overview_common.c.

Referenced by client_exit().

◆ overview_redraw_callback()

void overview_redraw_callback ( struct option option)

Callback to be called when an overview option is changed.

Definition at line 524 of file overview_common.c.

◆ overview_tile_color()

static struct color * overview_tile_color ( struct tile ptile)
static

Return color for overview map tile.

Definition at line 118 of file overview_common.c.

Referenced by put_overview_tile_area().

◆ overview_to_map_pos()

void overview_to_map_pos ( int map_x,
int map_y,
int  overview_x,
int  overview_y 
)

Finds the map coordinates for a given overview (canvas) position.

Definition at line 358 of file overview_common.c.

Referenced by butt_down_overviewcanvas(), left_butt_down_overviewcanvas(), minimap_window_callback(), minimap_view::mousePressEvent(), overview_update_line(), and right_butt_down_overviewcanvas().

◆ overview_update_tile()

void overview_update_tile ( struct tile ptile)

Redraw the given map position in the overview canvas.

Definition at line 411 of file overview_common.c.

Referenced by refresh_overview_canvas(), and unqueue_mapview_updates().

◆ put_overview_tile_area()

static void put_overview_tile_area ( struct canvas pcanvas,
struct tile ptile,
int  x,
int  y,
int  w,
int  h 
)
static

Draws the color for this tile onto the given rectangle of the canvas.

This is just a simple helper function for overview_update_tile, since sometimes a tile may cover more than one rectangle.

Definition at line 394 of file overview_common.c.

Referenced by overview_update_tile().

◆ redraw_overview()

static void redraw_overview ( void  )
static

Copies the overview image from the backing store to the window and draws the viewrect on top of it.

Definition at line 201 of file overview_common.c.

Referenced by center_tile_overviewcanvas(), flush_dirty_overview(), and refresh_overview_canvas().

◆ refresh_overview_canvas()

void refresh_overview_canvas ( void  )

Redraw the entire backing store for the overview minimap.

Definition at line 377 of file overview_common.c.

Referenced by calculate_overview_dimensions(), overview_redraw_callback(), request_toggle_fog_of_war(), set_client_state(), and unqueue_mapview_updates().

◆ refresh_overview_from_canvas()

void refresh_overview_from_canvas ( void  )

Copies the current centred image + viewrect unchanged to the client's overview window (for expose events etc).

Definition at line 185 of file overview_common.c.

Referenced by redraw_overview().

◆ wrap_double()

static double wrap_double ( double  value,
double  wrap 
)
static

Equivalent to FC_WRAP, but it works for doubles.

Definition at line 273 of file overview_common.c.

Referenced by center_tile_overviewcanvas().

Variable Documentation

◆ overview_dirty

bool overview_dirty = FALSE
static

Definition at line 49 of file overview_common.c.

Referenced by dirty_overview(), flush_dirty_overview(), and redraw_overview().

◆ OVERVIEW_TILE_SIZE

int OVERVIEW_TILE_SIZE = 2