21static uint32_t _map_dim_x;
22static uint32_t _map_dim_y;
74 std::array<uint8_t, MAP_SL_BUF_SIZE> buf;
79 for (
auto b : buf)
Tile(i++).type() = b;
85 std::array<uint8_t, MAP_SL_BUF_SIZE> buf;
90 for (
auto &b : buf) b =
Tile(i++).type();
101 std::array<uint8_t, MAP_SL_BUF_SIZE> buf;
106 for (
auto b : buf)
Tile(i++).height() = b;
112 std::array<uint8_t, MAP_SL_BUF_SIZE> buf;
117 for (
auto &b : buf) b =
Tile(i++).height();
128 std::array<uint8_t, MAP_SL_BUF_SIZE> buf;
133 for (
auto b : buf)
Tile(i++).m1() = b;
139 std::array<uint8_t, MAP_SL_BUF_SIZE> buf;
144 for (
auto &b : buf) b =
Tile(i++).m1();
155 std::array<uint16_t, MAP_SL_BUF_SIZE> buf;
163 for (
auto b : buf)
Tile(i++).m2() = b;
169 std::array<uint16_t, MAP_SL_BUF_SIZE> buf;
172 SlSetLength(
static_cast<uint32_t
>(size) *
sizeof(uint16_t));
174 for (
auto &b : buf) b =
Tile(i++).m2();
185 std::array<uint8_t, MAP_SL_BUF_SIZE> buf;
190 for (
auto b : buf)
Tile(i++).m3() = b;
196 std::array<uint8_t, MAP_SL_BUF_SIZE> buf;
201 for (
auto &b : buf) b =
Tile(i++).m3();
212 std::array<uint8_t, MAP_SL_BUF_SIZE> buf;
217 for (
auto b : buf)
Tile(i++).m4() = b;
223 std::array<uint8_t, MAP_SL_BUF_SIZE> buf;
228 for (
auto &b : buf) b =
Tile(i++).m4();
239 std::array<uint8_t, MAP_SL_BUF_SIZE> buf;
244 for (
auto b : buf)
Tile(i++).m5() = b;
250 std::array<uint8_t, MAP_SL_BUF_SIZE> buf;
255 for (
auto &b : buf) b =
Tile(i++).m5();
274 Tile(i++).m6() =
GB(b, 0, 2);
275 Tile(i++).m6() =
GB(b, 2, 2);
276 Tile(i++).m6() =
GB(b, 4, 2);
277 Tile(i++).m6() =
GB(b, 6, 2);
281 std::array<uint8_t, MAP_SL_BUF_SIZE> buf;
284 for (
auto b : buf)
Tile(i++).m6() = b;
291 std::array<uint8_t, MAP_SL_BUF_SIZE> buf;
296 for (
auto &b : buf) b =
Tile(i++).m6();
307 std::array<uint8_t, MAP_SL_BUF_SIZE> buf;
312 for (
auto b : buf)
Tile(i++).m7() = b;
318 std::array<uint8_t, MAP_SL_BUF_SIZE> buf;
323 for (
auto &b : buf) b =
Tile(i++).m7();
334 std::array<uint16_t, MAP_SL_BUF_SIZE> buf;
339 for (
auto b : buf)
Tile(i++).m8() = b;
345 std::array<uint16_t, MAP_SL_BUF_SIZE> buf;
348 SlSetLength(
static_cast<uint32_t
>(size) *
sizeof(uint16_t));
350 for (
auto &b : buf) b =
Tile(i++).m8();
Functions related to bit mathematics.
static constexpr uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
Declarations for savegames operations.
LoadCheckData _load_check_data
Data loaded from save during SL_LOAD_CHECK.
@ Tile
Destination is a tile.
Functions related to maps.
static constexpr uint MAP_SL_BUF_SIZE
Buffer size for saving/loading the map array. Sized to the smallest map.
Loading for map chunks before table headers were added.
const SaveLoadCompat _map_sl_compat[]
Original field order for _map_desc.
static const uint MIN_MAP_SIZE
Minimal map size = 64.
A number of safeguards to prevent using unsafe methods.
std::vector< SaveLoad > SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct)
Load a table header in a savegame compatible way.
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
void SlCopy(void *object, size_t length, VarType conv)
Copy a list of SaveLoadType::Variables to/from a savegame.
void SlErrorCorrupt(const std::string &msg)
Error handler for corrupt savegames.
void SlSetLength(size_t length)
Sets the length of either a RIFF object or the number of items in an array.
std::vector< SaveLoad > SlTableHeader(const SaveLoadTable &slt)
Save or Load a table header.
void SlGlobList(const SaveLoadTable &slt)
Save or Load (a list of) global variables.
Functions/types related to saving and loading games.
@ U16
A 16 bit unsigned int.
@ U8
A 8 bit unsigned int.
#define SLEG_CONDVAR(name, variable, type, from, to)
Storage of a global variable in some savegame versions.
std::reference_wrapper< const ChunkHandler > ChunkHandlerRef
A reference to ChunkHandler.
std::span< const ChunkHandlerRef > ChunkHandlerTable
A table of ChunkHandler entries.
bool IsSavegameVersionBefore(SaveLoadVersion major, uint8_t minor=0)
Checks whether the savegame is below major.
@ BigMap
Saveload version: 5.0, SVN revision: 1429 Making maps a different size than 256x256.
@ MultipleRoadStops
Saveload version: 6.0, SVN revision: 1721 Multi tile road stops, and some map size related fixes.
@ MaxVersion
Highest possible saveload version.
@ RiffToArray
Saveload version: 294, GitHub pull request: 9375 Changed many ChunkType::Riff chunks to ChunkType::A...
@ BridgeWormhole
Saveload version: 42, SVN revision: 7573 Bridges become wormholes, so more things can be built under...
@ Table
An Array with a header describing the elements.
@ Riff
4 bits store the chunk type, 28 bits the number of bytes.
Definition of base types and functions in a cross-platform compatible way.
ChunkHandler(ChunkId id, ChunkType type)
Create this ChunkHandler.
void Load() const override
Load the chunk.
void Save() const override
Save the chunk.
void Load() const override
Load the chunk.
void Save() const override
Save the chunk.
void Save() const override
Save the chunk.
void Load() const override
Load the chunk.
void Save() const override
Save the chunk.
void Load() const override
Load the chunk.
void Save() const override
Save the chunk.
void Load() const override
Load the chunk.
void Save() const override
Save the chunk.
void Load() const override
Load the chunk.
void Load() const override
Load the chunk.
void Save() const override
Save the chunk.
void Load() const override
Load the chunk.
void Save() const override
Save the chunk.
void Save() const override
Save the chunk.
void Load() const override
Load the chunk.
void Save() const override
Save the chunk.
void LoadCheck(size_t) const override
Load the chunk for game preview.
void Load() const override
Load the chunk.
void Load() const override
Load the chunk.
void Save() const override
Save the chunk.
static uint SizeX()
Get the size of the map along the X.
static uint SizeY()
Get the size of the map along the Y.
static void Allocate(uint size_x, uint size_y)
(Re)allocates a map with the given dimension
static uint Size()
Get the size of the map.
static constexpr VarType U16
Store a 16 bits unsigned int.
static constexpr VarType U8
Store a 8 bits unsigned int.
static constexpr VarType U32
Store a 32 bits unsigned int.
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > > TileIndex
The index/ID of a Tile.