Go to the documentation of this file.
10 #include "../stdafx.h"
11 #include "../date_func.h"
12 #include "../zoom_func.h"
13 #include "../window_gui.h"
14 #include "../window_func.h"
15 #include "../viewport_func.h"
16 #include "../gfx_func.h"
17 #include "../core/random_func.hpp"
22 #include "../safeguards.h"
29 int _saved_scrollpos_x;
30 int _saved_scrollpos_y;
33 void SaveViewportBeforeSaveGame()
44 void ResetViewportAfterLoadGame()
123 static void SaveLoad_DATE()
128 static void Check_DATE()
142 SLEG_VAR(_saved_scrollpos_zoom, SLE_UINT8),
146 static void SaveLoad_VIEW()
152 {
'DATE', SaveLoad_DATE, SaveLoad_DATE,
nullptr, Check_DATE, CH_RIFF},
153 {
'VIEW', SaveLoad_VIEW, SaveLoad_VIEW,
nullptr,
nullptr, CH_RIFF |
CH_LAST},
uint32 TileIndex
The index/ID of a Tile.
@ ZOOM_OUT
Zoom out (get helicopter view).
@ SL_MIN_VERSION
First savegame version.
int width
Screen width of the viewport.
DateFract _date_fract
Fractional part of the day.
ViewportData * viewport
Pointer to viewport data, if present.
int height
Screen height of the viewport.
int32 scrollpos_y
Currently shown y coordinate (virtual screen coordinate of topleft corner of the viewport).
LoadCheckData _load_check_data
Data loaded from save during SL_LOAD_CHECK.
@ ZOOM_NONE
Hack, used to update the button status.
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
@ CH_LAST
Last chunk in this array.
bool DoZoomInOutWindow(ZoomStateChange how, Window *w)
Zooms a viewport in a window in or out.
Randomizer _random
Random used in the game state calculations.
ZoomLevel
All zoom levels we know.
ClientSettings _settings_client
The current settings for this game.
@ ZOOM_LVL_MAX
Maximum zoom level.
Handlers and description of chunk.
#define SLE_NULL(length)
Empty space in every savegame version.
#define SLEG_CONDVAR(variable, type, from, to)
Storage of a global variable in some savegame versions.
ZoomLevel zoom_max
maximum zoom out level
#define SLE_CONDNULL(length, from, to)
Empty space in some savegame versions.
@ ZOOM_LVL_MIN
Minimum zoom level.
@ ZOOM_IN
Zoom in (get more detailed view).
Data structure for viewport, display of a part of the world.
Date _date
Current date in days (day counter)
@ SLV_11
11.0 2033 11.1 2041
byte _trees_tick_ctr
Determines when to consider building more trees.
PauseMode _pause_mode
The current pause mode.
uint16 _tick_counter
Ever incrementing (and sometimes wrapping) tick counter for setting off various events.
static bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor=0)
Checks whether the savegame is below major.
int virtual_width
width << zoom
int32 dest_scrollpos_y
Current destination y coordinate to display (virtual screen coordinate of topleft corner of the viewp...
uint32 state[2]
The state of the randomizer.
uint _cur_company_tick_index
used to generate a name for one company that doesn't have a name yet per tick
void SlGlobList(const SaveLoadGlobVarList *sldg)
Save or Load (a list of) global variables.
@ SL_MAX_VERSION
Highest possible saveload version.
ZoomLevel zoom_min
minimum zoom out level
#define SLEG_VAR(variable, type)
Storage of a global variable in every savegame version.
uint _next_competitor_start
the number of ticks before the next AI is started
int32 scrollpos_x
Currently shown x coordinate (virtual screen coordinate of topleft corner of the viewport).
static int ScaleByZoom(int value, ZoomLevel zoom)
Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL) When shifting right,...
uint16 _disaster_delay
Delay counter for considering the next disaster.
#define SLEG_END()
End marker of global variables save or load.
byte _age_cargo_skip_counter
Skip aging of cargo? Used before savegame version 162.
@ WC_MAIN_WINDOW
Main window; Window numbers:
ZoomLevel zoom
The zoom level of the viewport.
int32 dest_scrollpos_x
Current destination x coordinate to display (virtual screen coordinate of topleft corner of the viewp...
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
Data structure for an opened window.
int virtual_height
height << zoom
@ SLV_4
4.0 1 4.1 122 0.3.3, 0.3.4 4.2 1222 0.3.5 4.3 1417 4.4 1426
GUISettings gui
settings related to the GUI
#define DAYS_TILL_ORIGINAL_BASE_YEAR
The offset in days from the '_date == 0' till 'ConvertYMDToDate(ORIGINAL_BASE_YEAR,...