Make smallmap refresh period variable with map mode/zoom and pause state

This commit is contained in:
Jonathan G Rennison
2020-10-01 11:28:50 +01:00
parent 151a4d85b9
commit 1867cebc4a
2 changed files with 32 additions and 6 deletions

View File

@@ -90,8 +90,10 @@ protected:
static const uint LEGEND_BLOB_WIDTH = 8; ///< Width of the coloured blob in front of a line text in the #WID_SM_LEGEND widget.
static const uint INDUSTRY_MIN_NUMBER_OF_COLUMNS = 2; ///< Minimal number of columns in the #WID_SM_LEGEND widget for the #SMT_INDUSTRY legend.
static const uint FORCE_REFRESH_PERIOD = 2850; ///< map is redrawn after that many milliseconds.
static const uint BLINK_PERIOD = 450; ///< highlight blinking interval in milliseconds.
static const uint FORCE_REFRESH_PERIOD = 930; ///< map is redrawn after that many milliseconds (default).
static const uint FORCE_REFRESH_PERIOD_VEH = 240; ///< map is redrawn after that many milliseconds (modes with vehicles).
static const uint FORCE_REFRESH_PERIOD_LINK_GRAPH = 2850; ///< map is redrawn after that many milliseconds (link graph mode).
static const uint BLINK_PERIOD = 450; ///< highlight blinking interval in milliseconds.
uint min_number_of_columns; ///< Minimal number of columns in legends.
uint min_number_of_fixed_rows; ///< Minimal number of rows in the legends for the fixed layouts only (all except #SMT_INDUSTRY).
@@ -103,6 +105,7 @@ protected:
int zoom; ///< Zoom level. Bigger number means more zoom-out (further away).
GUITimer refresh; ///< Refresh timer.
bool unpaused_since_last_redraw = false;
LinkGraphOverlay *overlay;
static void BreakIndustryChainLink();
@@ -175,6 +178,7 @@ protected:
void SelectLegendItem(int click_pos, LegendAndColour *legend, int end_legend_item, int begin_legend_item = 0);
void SwitchMapType(SmallMapType map_type);
void SetNewScroll(int sx, int sy, int sub);
uint GetRefreshPeriod() const;
void DrawMapIndicators() const;
void DrawSmallMapColumn(void *dst, uint xc, uint yc, int pitch, int reps, int start_pos, int end_pos, Blitter *blitter) const;