OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
10 #include "../stdafx.h"
15 #include "../date_func.h"
16 #include "../zoom_func.h"
17 #include "../window_gui.h"
18 #include "../window_func.h"
19 #include "../viewport_func.h"
20 #include "../gfx_func.h"
21 #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()
73 static const SaveLoad _date_desc[] = {
91 static const SaveLoad _date_check_desc[] = {
134 static const SaveLoad _view_desc[] = {
139 SLEG_VAR(
"zoom", _saved_scrollpos_zoom, SLE_UINT8),
uint32 TileIndex
The index/ID of a Tile.
@ SLV_RIFF_TO_ARRAY
294 PR#9375 Changed many CH_RIFF chunks to CH_ARRAY chunks.
@ ZOOM_OUT
Zoom out (get helicopter view).
@ SL_MIN_VERSION
First savegame version.
int width
Screen width of the viewport.
std::reference_wrapper< const ChunkHandler > ChunkHandlerRef
A reference to ChunkHandler.
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.
void Load() const override
Load the chunk.
const SaveLoadCompat _date_check_sl_compat[]
Original field order for _date_check_desc.
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.
void Save() const override
Save the chunk.
Handlers and description of chunk.
ZoomLevel zoom_max
maximum zoom out level
void SlGlobList(const SaveLoadTable &slt)
Save or Load (a list of) global variables.
@ 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)
A trimmed down version of what std::span will be in C++20.
#define SLEG_VAR(name, variable, type)
Storage of a global variable in every savegame version.
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.
const SaveLoadCompat _date_sl_compat[]
Original field order for _date_desc.
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
@ SL_MAX_VERSION
Highest possible saveload version.
ZoomLevel zoom_min
minimum zoom out level
void Load() const override
Load the chunk.
uint _next_competitor_start
the number of ticks before the next AI is started
void LoadCheck(size_t) const override
Load the chunk for game preview.
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_CONDVAR(name, variable, type, from, to)
Storage of a global variable in some savegame versions.
const SaveLoadCompat _view_sl_compat[]
Original field order for _view_desc.
void NORETURN SlErrorCorrupt(const char *msg)
Error handler for corrupt savegames.
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.
std::vector< SaveLoad > SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct)
Load a table header in a savegame compatible way.
Data structure for an opened window.
void Save() const override
Save the chunk.
int virtual_height
height << zoom
std::vector< SaveLoad > SlTableHeader(const SaveLoadTable &slt)
Save or Load a table header.
@ 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
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
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,...