12 #include "../stdafx.h" 13 #include "../date_func.h" 14 #include "../zoom_func.h" 15 #include "../window_gui.h" 16 #include "../window_func.h" 17 #include "../viewport_func.h" 18 #include "../gfx_func.h" 19 #include "../core/random_func.hpp" 24 #include "../safeguards.h" 31 int _saved_scrollpos_x;
32 int _saved_scrollpos_y;
35 void SaveViewportBeforeSaveGame()
46 void ResetViewportAfterLoadGame()
79 SLEG_CONDVAR(_age_cargo_skip_counter, SLE_UINT8, 0, 161),
81 SLEG_CONDVAR(_cur_tileloop_tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
125 static void SaveLoad_DATE()
130 static void Check_DATE()
140 SLEG_CONDVAR(_saved_scrollpos_x, SLE_FILE_I16 | SLE_VAR_I32, 0, 5),
142 SLEG_CONDVAR(_saved_scrollpos_y, SLE_FILE_I16 | SLE_VAR_I32, 0, 5),
144 SLEG_VAR(_saved_scrollpos_zoom, SLE_UINT8),
148 static void SaveLoad_VIEW()
154 {
'DATE', SaveLoad_DATE, SaveLoad_DATE, NULL, Check_DATE, CH_RIFF},
155 {
'VIEW', SaveLoad_VIEW, SaveLoad_VIEW, NULL, NULL, CH_RIFF |
CH_LAST},
#define SLE_CONDNULL(length, from, to)
Empty space in some savegame versions.
bool DoZoomInOutWindow(ZoomStateChange how, Window *w)
Zooms a viewport in a window in or out.
ZoomLevelByte zoom_max
maximum zoom out level
#define SLEG_END()
End marker of global variables save or load.
#define DAYS_TILL_ORIGINAL_BASE_YEAR
The offset in days from the '_date == 0' till 'ConvertYMDToDate(ORIGINAL_BASE_YEAR, 0, 1)'.
Zoom out (get helicopter view).
int height
Screen height of the viewport.
#define SLE_NULL(length)
Empty space in every savegame version.
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
int virtual_height
height << zoom
byte _trees_tick_ctr
Determines when to consider building more trees.
static int ScaleByZoom(int value, ZoomLevel zoom)
Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL) When shifting right...
Zoom in (get more detailed view).
#define SLEG_VAR(variable, type)
Storage of a global variable in every savegame version.
uint _cur_company_tick_index
used to generate a name for one company that doesn't have a name yet per tick
Data structure for an opened window.
Main window; Window numbers:
LoadCheckData _load_check_data
Data loaded from save during SL_LOAD_CHECK.
Functions/types related to saving and loading games.
DateFract _date_fract
Fractional part of the day.
ClientSettings _settings_client
The current settings for this game.
int32 scrollpos_x
Currently shown x coordinate (virtual screen coordinate of topleft corner of the viewport).
int virtual_width
width << zoom
#define SL_MAX_VERSION
Highest possible savegame version.
static bool IsSavegameVersionBefore(uint16 major, byte minor=0)
Checks whether the savegame is below major.
PauseModeByte _pause_mode
The current pause mode.
static T min(const T a, const T b)
Returns the minimum of two values.
int32 dest_scrollpos_y
Current destination y coordinate to display (virtual screen coordinate of topleft corner of the viewp...
Handlers and description of chunk.
#define SLEG_CONDVAR(variable, type, from, to)
Storage of a global variable in some savegame versions.
uint16 _tick_counter
Ever incrementing (and sometimes wrapping) tick counter for setting off various events.
ZoomLevelByte zoom_min
minimum zoom out level
ZoomLevel
All zoom levels we know.
int32 dest_scrollpos_x
Current destination x coordinate to display (virtual screen coordinate of topleft corner of the viewp...
GUISettings gui
settings related to the GUI
Data structure for viewport, display of a part of the world.
uint32 TileIndex
The index/ID of a Tile.
Randomizer _random
Random used in the game state calculations.
uint _next_competitor_start
the number of ticks before the next AI is started
uint16 _disaster_delay
Delay counter for considering the next disaster.
void SlGlobList(const SaveLoadGlobVarList *sldg)
Save or Load (a list of) global variables.
ZoomLevel zoom
The zoom level of the viewport.
uint32 state[2]
The state of the randomizer.
ViewportData * viewport
Pointer to viewport data, if present.
Date _date
Current date in days (day counter)
int32 scrollpos_y
Currently shown y coordinate (virtual screen coordinate of topleft corner of the viewport).
Hack, used to update the button status.
byte _age_cargo_skip_counter
Skip aging of cargo? Used before savegame version 162.
Last chunk in this array.
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
int width
Screen width of the viewport.