Codechange: make ChunkType scoped

This commit is contained in:
Rubidium
2026-06-28 06:23:32 +02:00
committed by rubidium42
parent b7d07252e7
commit a76ba0d3d4
39 changed files with 144 additions and 144 deletions
+16 -16
View File
@@ -69,19 +69,19 @@ An example of a valid tag is `PLYR` when looking at it via ASCII, which contains
`[4..4]` - Next follows a byte where the lower 4 bits contain the type. `[4..4]` - Next follows a byte where the lower 4 bits contain the type.
The possible valid types are: The possible valid types are:
- `0` - `CH_RIFF` - This chunk is a binary blob. - `0` - `ChunkType::Riff` - This chunk is a binary blob.
- `1` - `CH_ARRAY` - This chunk is a list of items. - `1` - `ChunkType::Array` - This chunk is a list of items.
- `2` - `CH_SPARSE_ARRAY` - This chunk is a list of items. - `2` - `ChunkType::SparseArray` - This chunk is a list of items.
- `3` - `CH_TABLE` - This chunk is self-describing list of items. - `3` - `ChunkType::Table` - This chunk is self-describing list of items.
- `4` - `CH_SPARSE_TABLE` - This chunk is self-describing list of items. - `4` - `ChunkType::SparseTable` - This chunk is self-describing list of items.
Now per type the format is (slightly) different. Now per type the format is (slightly) different.
### CH_RIFF ### ChunkType::Riff
(since savegame version 295, this chunk type is only used for MAP-chunks, containing bit-information about each tile on the map) (since savegame version 295, this chunk type is only used for MAP-chunks, containing bit-information about each tile on the map)
A `CH_RIFF` starts with an `uint24` which together with the upper-bits of the type defines the length of the chunk. A `ChunkType::Riff` starts with an `uint24` which together with the upper-bits of the type defines the length of the chunk.
In pseudo-code: In pseudo-code:
``` ```
@@ -94,11 +94,11 @@ if type == 0
The next `length` bytes are part of the chunk. The next `length` bytes are part of the chunk.
What those bytes mean depends on the tag of the chunk; further details per chunk can be found in the source-code. What those bytes mean depends on the tag of the chunk; further details per chunk can be found in the source-code.
### CH_ARRAY / CH_SPARSE_ARRAY ### ChunkType::Array / ChunkType::SparseArray
(this chunk type is deprecated since savegame version 295 and is no longer in use) (this chunk type is deprecated since savegame version 295 and is no longer in use)
`[0..G1]` - A `CH_ARRAY` / `CH_SPARSE_ARRAY` starts with a `gamma`, indicating the size of the next item plus one. `[0..G1]` - A `ChunkType::Array` / `ChunkType::SparseArray` starts with a `gamma`, indicating the size of the next item plus one.
If this size value is zero, it indicates the end of the list. If this size value is zero, it indicates the end of the list.
This indicates the full length of the next item minus one. This indicates the full length of the next item minus one.
In psuedo-code: In psuedo-code:
@@ -111,21 +111,21 @@ loop
read <size> bytes read <size> bytes
``` ```
`[]` - For `CH_ARRAY` there is an implicit index. `[]` - For `ChunkType::Array` there is an implicit index.
The loop starts at zero, and every iteration adds one to the index. The loop starts at zero, and every iteration adds one to the index.
For entries in the game that were not allocated, the `size` will be zero. For entries in the game that were not allocated, the `size` will be zero.
`[G1+1..G2]` - For `CH_SPARSE_ARRAY` there is an explicit index. `[G1+1..G2]` - For `ChunkType::SparseArray` there is an explicit index.
The `gamma` following the size indicates the index. The `gamma` following the size indicates the index.
The content of the item is a binary blob, and similar to `CH_RIFF`, it depends on the tag of the chunk what it means. The content of the item is a binary blob, and similar to `ChunkType::Riff`, it depends on the tag of the chunk what it means.
Please check the source-code for further details. Please check the source-code for further details.
### CH_TABLE / CH_SPARSE_TABLE ### ChunkType::Table / ChunkType::SparseTable
(this chunk type only exists since savegame version 295) (this chunk type only exists since savegame version 295)
Both `CH_TABLE` and `CH_SPARSE_TABLE` are very similar to `CH_ARRAY` / `CH_SPARSE_ARRAY` respectively. Both `ChunkType::Table` and `ChunkType::SparseTable` are very similar to `ChunkType::Array` / `ChunkType::SparseArray` respectively.
The only change is that the chunk starts with a header. The only change is that the chunk starts with a header.
This header describes the chunk in details; with the header you know the meaning of each byte in the binary blob that follows. This header describes the chunk in details; with the header you know the meaning of each byte in the binary blob that follows.
@@ -168,7 +168,7 @@ struct | substruct3
The headers will be, in order: `table`, `substruct1`, `substruct3`, `substruct2`, each ending with a `type` is zero field. The headers will be, in order: `table`, `substruct1`, `substruct3`, `substruct2`, each ending with a `type` is zero field.
After reading all the fields of all the headers, there is a list of records. After reading all the fields of all the headers, there is a list of records.
To read this, see `CH_ARRAY` / `CH_SPARSE_ARRAY` for details. To read this, see `ChunkType::Array` / `ChunkType::SparseArray` for details.
As each `type` has a well defined length, you can read the records even without knowing anything about the chunk-tag yourself. As each `type` has a well defined length, you can read the records even without knowing anything about the chunk-tag yourself.
@@ -187,7 +187,7 @@ The prefix is strongly advised to avoid conflicts with future-settings in an unp
## Scripts custom data format ## Scripts custom data format
Script chunks (`AIPL` and `GSDT`) use `CH_TABLE` chunk type. Script chunks (`AIPL` and `GSDT`) use `ChunkType::Table` chunk type.
At the end of each record there's an `uint8` to indicate if there's custom data (1) or not (0). At the end of each record there's an `uint8` to indicate if there's custom data (1) or not (0).
+1 -1
View File
@@ -73,7 +73,7 @@ static void SaveReal_AIPL(int arg)
} }
struct AIPLChunkHandler : ChunkHandler { struct AIPLChunkHandler : ChunkHandler {
AIPLChunkHandler() : ChunkHandler('AIPL', CH_TABLE) {} AIPLChunkHandler() : ChunkHandler('AIPL', ChunkType::Table) {}
void Load() const override void Load() const override
{ {
+1 -1
View File
@@ -23,7 +23,7 @@ static const SaveLoad _animated_tile_desc[] = {
}; };
struct ANITChunkHandler : ChunkHandler { struct ANITChunkHandler : ChunkHandler {
ANITChunkHandler() : ChunkHandler('ANIT', CH_TABLE) {} ANITChunkHandler() : ChunkHandler('ANIT', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+1 -1
View File
@@ -26,7 +26,7 @@ static const SaveLoad _engine_renew_desc[] = {
}; };
struct ERNWChunkHandler : ChunkHandler { struct ERNWChunkHandler : ChunkHandler {
ERNWChunkHandler() : ChunkHandler('ERNW', CH_TABLE) {} ERNWChunkHandler() : ChunkHandler('ERNW', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+2 -2
View File
@@ -45,7 +45,7 @@ static CargoMonitorID FixupCargoMonitor(CargoMonitorID number)
/** #_cargo_deliveries monitoring map. */ /** #_cargo_deliveries monitoring map. */
struct CMDLChunkHandler : ChunkHandler { struct CMDLChunkHandler : ChunkHandler {
CMDLChunkHandler() : ChunkHandler('CMDL', CH_TABLE) {} CMDLChunkHandler() : ChunkHandler('CMDL', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
@@ -88,7 +88,7 @@ struct CMDLChunkHandler : ChunkHandler {
/** #_cargo_pickups monitoring map. */ /** #_cargo_pickups monitoring map. */
struct CMPUChunkHandler : ChunkHandler { struct CMPUChunkHandler : ChunkHandler {
CMPUChunkHandler() : ChunkHandler('CMPU', CH_TABLE) {} CMPUChunkHandler() : ChunkHandler('CMPU', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+1 -1
View File
@@ -143,7 +143,7 @@ SaveLoadTable GetCargoPacketDesc()
} }
struct CAPAChunkHandler : ChunkHandler { struct CAPAChunkHandler : ChunkHandler {
CAPAChunkHandler() : ChunkHandler('CAPA', CH_TABLE) {} CAPAChunkHandler() : ChunkHandler('CAPA', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+1 -1
View File
@@ -39,7 +39,7 @@ static const SaveLoad _cheats_desc[] = {
struct CHTSChunkHandler : ChunkHandler { struct CHTSChunkHandler : ChunkHandler {
CHTSChunkHandler() : ChunkHandler('CHTS', CH_TABLE) {} CHTSChunkHandler() : ChunkHandler('CHTS', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+1 -1
View File
@@ -551,7 +551,7 @@ static const SaveLoad _company_desc[] = {
}; };
struct PLYRChunkHandler : ChunkHandler { struct PLYRChunkHandler : ChunkHandler {
PLYRChunkHandler() : ChunkHandler('PLYR', CH_TABLE) {} PLYRChunkHandler() : ChunkHandler('PLYR', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+1 -1
View File
@@ -30,7 +30,7 @@ static const SaveLoad _depot_desc[] = {
}; };
struct DEPTChunkHandler : ChunkHandler { struct DEPTChunkHandler : ChunkHandler {
DEPTChunkHandler() : ChunkHandler('DEPT', CH_TABLE) {} DEPTChunkHandler() : ChunkHandler('DEPT', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+4 -4
View File
@@ -19,7 +19,7 @@
/** Prices in pre 126 savegames */ /** Prices in pre 126 savegames */
struct PRICChunkHandler : ChunkHandler { struct PRICChunkHandler : ChunkHandler {
PRICChunkHandler() : ChunkHandler('PRIC', CH_READONLY) {} PRICChunkHandler() : ChunkHandler('PRIC', ChunkType::ReadOnly) {}
void Load() const override void Load() const override
{ {
@@ -32,7 +32,7 @@ struct PRICChunkHandler : ChunkHandler {
/** Cargo payment rates in pre 126 savegames */ /** Cargo payment rates in pre 126 savegames */
struct CAPRChunkHandler : ChunkHandler { struct CAPRChunkHandler : ChunkHandler {
CAPRChunkHandler() : ChunkHandler('CAPR', CH_READONLY) {} CAPRChunkHandler() : ChunkHandler('CAPR', ChunkType::ReadOnly) {}
void Load() const override void Load() const override
{ {
@@ -58,7 +58,7 @@ static const SaveLoad _economy_desc[] = {
/** Economy variables */ /** Economy variables */
struct ECMYChunkHandler : ChunkHandler { struct ECMYChunkHandler : ChunkHandler {
ECMYChunkHandler() : ChunkHandler('ECMY', CH_TABLE) {} ECMYChunkHandler() : ChunkHandler('ECMY', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
@@ -89,7 +89,7 @@ static const SaveLoad _cargopayment_desc[] = {
}; };
struct CAPYChunkHandler : ChunkHandler { struct CAPYChunkHandler : ChunkHandler {
CAPYChunkHandler() : ChunkHandler('CAPY', CH_TABLE) {} CAPYChunkHandler() : ChunkHandler('CAPY', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+3 -3
View File
@@ -62,7 +62,7 @@ Engine *GetTempDataEngine(EngineID index, VehicleType type, uint16_t local_id)
} }
struct ENGNChunkHandler : ChunkHandler { struct ENGNChunkHandler : ChunkHandler {
ENGNChunkHandler() : ChunkHandler('ENGN', CH_TABLE) {} ENGNChunkHandler() : ChunkHandler('ENGN', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
@@ -135,7 +135,7 @@ void ResetTempEngineData()
} }
struct ENGSChunkHandler : ChunkHandler { struct ENGSChunkHandler : ChunkHandler {
ENGSChunkHandler() : ChunkHandler('ENGS', CH_READONLY) {} ENGSChunkHandler() : ChunkHandler('ENGS', ChunkType::ReadOnly) {}
void Load() const override void Load() const override
{ {
@@ -162,7 +162,7 @@ static const SaveLoad _engine_id_mapping_desc[] = {
}; };
struct EIDSChunkHandler : ChunkHandler { struct EIDSChunkHandler : ChunkHandler {
EIDSChunkHandler() : ChunkHandler('EIDS', CH_TABLE) {} EIDSChunkHandler() : ChunkHandler('EIDS', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+2 -2
View File
@@ -52,7 +52,7 @@ static void SaveReal_GSDT(int)
} }
struct GSDTChunkHandler : ChunkHandler { struct GSDTChunkHandler : ChunkHandler {
GSDTChunkHandler() : ChunkHandler('GSDT', CH_TABLE) {} GSDTChunkHandler() : ChunkHandler('GSDT', ChunkType::Table) {}
void Load() const override void Load() const override
{ {
@@ -153,7 +153,7 @@ static const SaveLoad _game_language_desc[] = {
}; };
struct GSTRChunkHandler : ChunkHandler { struct GSTRChunkHandler : ChunkHandler {
GSTRChunkHandler() : ChunkHandler('GSTR', CH_TABLE) {} GSTRChunkHandler() : ChunkHandler('GSTR', ChunkType::Table) {}
void Load() const override void Load() const override
{ {
+1 -1
View File
@@ -375,7 +375,7 @@ static const SaveLoad _gamelog_desc[] = {
}; };
struct GLOGChunkHandler : ChunkHandler { struct GLOGChunkHandler : ChunkHandler {
GLOGChunkHandler() : ChunkHandler('GLOG', CH_TABLE) {} GLOGChunkHandler() : ChunkHandler('GLOG', ChunkType::Table) {}
void LoadCommon(Gamelog &gamelog) const void LoadCommon(Gamelog &gamelog) const
{ {
+1 -1
View File
@@ -26,7 +26,7 @@ static const SaveLoad _goals_desc[] = {
}; };
struct GOALChunkHandler : ChunkHandler { struct GOALChunkHandler : ChunkHandler {
GOALChunkHandler() : ChunkHandler('GOAL', CH_TABLE) {} GOALChunkHandler() : ChunkHandler('GOAL', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+1 -1
View File
@@ -30,7 +30,7 @@ static const SaveLoad _group_desc[] = {
}; };
struct GRPSChunkHandler : ChunkHandler { struct GRPSChunkHandler : ChunkHandler {
GRPSChunkHandler() : ChunkHandler('GRPS', CH_TABLE) {} GRPSChunkHandler() : ChunkHandler('GRPS', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+3 -3
View File
@@ -211,7 +211,7 @@ static const SaveLoad _industry_desc[] = {
}; };
struct INDYChunkHandler : ChunkHandler { struct INDYChunkHandler : ChunkHandler {
INDYChunkHandler() : ChunkHandler('INDY', CH_TABLE) {} INDYChunkHandler() : ChunkHandler('INDY', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
@@ -317,7 +317,7 @@ static const SaveLoad _industry_builder_desc[] = {
/** Industry builder. */ /** Industry builder. */
struct IBLDChunkHandler : ChunkHandler { struct IBLDChunkHandler : ChunkHandler {
IBLDChunkHandler() : ChunkHandler('IBLD', CH_TABLE) {} IBLDChunkHandler() : ChunkHandler('IBLD', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
@@ -348,7 +348,7 @@ static const SaveLoad _industrytype_builder_desc[] = {
/** Industry-type build data. */ /** Industry-type build data. */
struct ITBLChunkHandler : ChunkHandler { struct ITBLChunkHandler : ChunkHandler {
ITBLChunkHandler() : ChunkHandler('ITBL', CH_TABLE) {} ITBLChunkHandler() : ChunkHandler('ITBL', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+2 -2
View File
@@ -34,7 +34,7 @@ void AfterLoadLabelMaps()
} }
struct RAILChunkHandler : ChunkHandler { struct RAILChunkHandler : ChunkHandler {
RAILChunkHandler() : ChunkHandler('RAIL', CH_TABLE) {} RAILChunkHandler() : ChunkHandler('RAIL', ChunkType::Table) {}
static inline const SaveLoad description[] = { static inline const SaveLoad description[] = {
SLE_VAR(LabelObject<RailTypeLabel>, label, SLE_UINT32), SLE_VAR(LabelObject<RailTypeLabel>, label, SLE_UINT32),
@@ -69,7 +69,7 @@ struct RAILChunkHandler : ChunkHandler {
}; };
struct ROTTChunkHandler : ChunkHandler { struct ROTTChunkHandler : ChunkHandler {
ROTTChunkHandler() : ChunkHandler('ROTT', CH_TABLE) {} ROTTChunkHandler() : ChunkHandler('ROTT', ChunkType::Table) {}
static inline const SaveLoad description[] = { static inline const SaveLoad description[] = {
SLE_VAR(LabelObject<RoadTypeLabel>, label, SLE_UINT32), SLE_VAR(LabelObject<RoadTypeLabel>, label, SLE_UINT32),
+2 -2
View File
@@ -27,7 +27,7 @@ static const SaveLoad _league_table_elements_desc[] = {
}; };
struct LEAEChunkHandler : ChunkHandler { struct LEAEChunkHandler : ChunkHandler {
LEAEChunkHandler() : ChunkHandler('LEAE', CH_TABLE) {} LEAEChunkHandler() : ChunkHandler('LEAE', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
@@ -58,7 +58,7 @@ static const SaveLoad _league_tables_desc[] = {
}; };
struct LEATChunkHandler : ChunkHandler { struct LEATChunkHandler : ChunkHandler {
LEATChunkHandler() : ChunkHandler('LEAT', CH_TABLE) {} LEATChunkHandler() : ChunkHandler('LEAT', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+3 -3
View File
@@ -259,7 +259,7 @@ void AfterLoadLinkGraphs()
* All link graphs. * All link graphs.
*/ */
struct LGRPChunkHandler : ChunkHandler { struct LGRPChunkHandler : ChunkHandler {
LGRPChunkHandler() : ChunkHandler('LGRP', CH_TABLE) {} LGRPChunkHandler() : ChunkHandler('LGRP', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
@@ -287,7 +287,7 @@ struct LGRPChunkHandler : ChunkHandler {
* All link graph jobs. * All link graph jobs.
*/ */
struct LGRJChunkHandler : ChunkHandler { struct LGRJChunkHandler : ChunkHandler {
LGRJChunkHandler() : ChunkHandler('LGRJ', CH_TABLE) {} LGRJChunkHandler() : ChunkHandler('LGRJ', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
@@ -315,7 +315,7 @@ struct LGRJChunkHandler : ChunkHandler {
* Link graph schedule. * Link graph schedule.
*/ */
struct LGRSChunkHandler : ChunkHandler { struct LGRSChunkHandler : ChunkHandler {
LGRSChunkHandler() : ChunkHandler('LGRS', CH_TABLE) {} LGRSChunkHandler() : ChunkHandler('LGRS', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+11 -11
View File
@@ -27,7 +27,7 @@ static const SaveLoad _map_desc[] = {
}; };
struct MAPSChunkHandler : ChunkHandler { struct MAPSChunkHandler : ChunkHandler {
MAPSChunkHandler() : ChunkHandler('MAPS', CH_TABLE) {} MAPSChunkHandler() : ChunkHandler('MAPS', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
@@ -67,7 +67,7 @@ struct MAPSChunkHandler : ChunkHandler {
static const uint MAP_SL_BUF_SIZE = 4096; static const uint MAP_SL_BUF_SIZE = 4096;
struct MAPTChunkHandler : ChunkHandler { struct MAPTChunkHandler : ChunkHandler {
MAPTChunkHandler() : ChunkHandler('MAPT', CH_RIFF) {} MAPTChunkHandler() : ChunkHandler('MAPT', ChunkType::Riff) {}
void Load() const override void Load() const override
{ {
@@ -94,7 +94,7 @@ struct MAPTChunkHandler : ChunkHandler {
}; };
struct MAPHChunkHandler : ChunkHandler { struct MAPHChunkHandler : ChunkHandler {
MAPHChunkHandler() : ChunkHandler('MAPH', CH_RIFF) {} MAPHChunkHandler() : ChunkHandler('MAPH', ChunkType::Riff) {}
void Load() const override void Load() const override
{ {
@@ -121,7 +121,7 @@ struct MAPHChunkHandler : ChunkHandler {
}; };
struct MAPOChunkHandler : ChunkHandler { struct MAPOChunkHandler : ChunkHandler {
MAPOChunkHandler() : ChunkHandler('MAPO', CH_RIFF) {} MAPOChunkHandler() : ChunkHandler('MAPO', ChunkType::Riff) {}
void Load() const override void Load() const override
{ {
@@ -148,7 +148,7 @@ struct MAPOChunkHandler : ChunkHandler {
}; };
struct MAP2ChunkHandler : ChunkHandler { struct MAP2ChunkHandler : ChunkHandler {
MAP2ChunkHandler() : ChunkHandler('MAP2', CH_RIFF) {} MAP2ChunkHandler() : ChunkHandler('MAP2', ChunkType::Riff) {}
void Load() const override void Load() const override
{ {
@@ -178,7 +178,7 @@ struct MAP2ChunkHandler : ChunkHandler {
}; };
struct M3LOChunkHandler : ChunkHandler { struct M3LOChunkHandler : ChunkHandler {
M3LOChunkHandler() : ChunkHandler('M3LO', CH_RIFF) {} M3LOChunkHandler() : ChunkHandler('M3LO', ChunkType::Riff) {}
void Load() const override void Load() const override
{ {
@@ -205,7 +205,7 @@ struct M3LOChunkHandler : ChunkHandler {
}; };
struct M3HIChunkHandler : ChunkHandler { struct M3HIChunkHandler : ChunkHandler {
M3HIChunkHandler() : ChunkHandler('M3HI', CH_RIFF) {} M3HIChunkHandler() : ChunkHandler('M3HI', ChunkType::Riff) {}
void Load() const override void Load() const override
{ {
@@ -232,7 +232,7 @@ struct M3HIChunkHandler : ChunkHandler {
}; };
struct MAP5ChunkHandler : ChunkHandler { struct MAP5ChunkHandler : ChunkHandler {
MAP5ChunkHandler() : ChunkHandler('MAP5', CH_RIFF) {} MAP5ChunkHandler() : ChunkHandler('MAP5', ChunkType::Riff) {}
void Load() const override void Load() const override
{ {
@@ -259,7 +259,7 @@ struct MAP5ChunkHandler : ChunkHandler {
}; };
struct MAPEChunkHandler : ChunkHandler { struct MAPEChunkHandler : ChunkHandler {
MAPEChunkHandler() : ChunkHandler('MAPE', CH_RIFF) {} MAPEChunkHandler() : ChunkHandler('MAPE', ChunkType::Riff) {}
void Load() const override void Load() const override
{ {
@@ -299,7 +299,7 @@ struct MAPEChunkHandler : ChunkHandler {
}; };
struct MAP7ChunkHandler : ChunkHandler { struct MAP7ChunkHandler : ChunkHandler {
MAP7ChunkHandler() : ChunkHandler('MAP7', CH_RIFF) {} MAP7ChunkHandler() : ChunkHandler('MAP7', ChunkType::Riff) {}
void Load() const override void Load() const override
{ {
@@ -326,7 +326,7 @@ struct MAP7ChunkHandler : ChunkHandler {
}; };
struct MAP8ChunkHandler : ChunkHandler { struct MAP8ChunkHandler : ChunkHandler {
MAP8ChunkHandler() : ChunkHandler('MAP8', CH_RIFF) {} MAP8ChunkHandler() : ChunkHandler('MAP8', ChunkType::Riff) {}
void Load() const override void Load() const override
{ {
+2 -2
View File
@@ -121,7 +121,7 @@ static const SaveLoad _date_check_desc[] = {
* @note currently some unrelated stuff is just put here. * @note currently some unrelated stuff is just put here.
*/ */
struct DATEChunkHandler : ChunkHandler { struct DATEChunkHandler : ChunkHandler {
DATEChunkHandler() : ChunkHandler('DATE', CH_TABLE) {} DATEChunkHandler() : ChunkHandler('DATE', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
@@ -165,7 +165,7 @@ static const SaveLoad _view_desc[] = {
}; };
struct VIEWChunkHandler : ChunkHandler { struct VIEWChunkHandler : ChunkHandler {
VIEWChunkHandler() : ChunkHandler('VIEW', CH_TABLE) {} VIEWChunkHandler() : ChunkHandler('VIEW', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+1 -1
View File
@@ -62,7 +62,7 @@ void NewGRFMappingChunkHandler::Load() const
} }
struct NGRFChunkHandler : ChunkHandler { struct NGRFChunkHandler : ChunkHandler {
NGRFChunkHandler() : ChunkHandler('NGRF', CH_TABLE) {} NGRFChunkHandler() : ChunkHandler('NGRF', ChunkType::Table) {}
static inline std::array<uint32_t, GRFConfig::MAX_NUM_PARAMS> param; static inline std::array<uint32_t, GRFConfig::MAX_NUM_PARAMS> param;
static inline uint8_t num_params; static inline uint8_t num_params;
+1 -1
View File
@@ -16,7 +16,7 @@
struct NewGRFMappingChunkHandler : ChunkHandler { struct NewGRFMappingChunkHandler : ChunkHandler {
OverrideManagerBase &mapping; OverrideManagerBase &mapping;
NewGRFMappingChunkHandler(uint32_t id, OverrideManagerBase &mapping) : ChunkHandler(id, CH_TABLE), mapping(mapping) {} NewGRFMappingChunkHandler(uint32_t id, OverrideManagerBase &mapping) : ChunkHandler(id, ChunkType::Table), mapping(mapping) {}
void Save() const override; void Save() const override;
void Load() const override; void Load() const override;
}; };
+1 -1
View File
@@ -30,7 +30,7 @@ static const SaveLoad _object_desc[] = {
}; };
struct OBJSChunkHandler : ChunkHandler { struct OBJSChunkHandler : ChunkHandler {
OBJSChunkHandler() : ChunkHandler('OBJS', CH_TABLE) {} OBJSChunkHandler() : ChunkHandler('OBJS', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+3 -3
View File
@@ -159,7 +159,7 @@ SaveLoadTable GetOrderDescription()
} }
struct ORDRChunkHandler : ChunkHandler { struct ORDRChunkHandler : ChunkHandler {
ORDRChunkHandler() : ChunkHandler('ORDR', CH_READONLY) {} ORDRChunkHandler() : ChunkHandler('ORDR', ChunkType::ReadOnly) {}
void Load() const override void Load() const override
{ {
@@ -249,7 +249,7 @@ SaveLoadTable GetOrderListDescription()
} }
struct ORDLChunkHandler : ChunkHandler { struct ORDLChunkHandler : ChunkHandler {
ORDLChunkHandler() : ChunkHandler('ORDL', CH_TABLE) {} ORDLChunkHandler() : ChunkHandler('ORDL', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
@@ -320,7 +320,7 @@ SaveLoadTable GetOrderBackupDescription()
} }
struct BKORChunkHandler : ChunkHandler { struct BKORChunkHandler : ChunkHandler {
BKORChunkHandler() : ChunkHandler('BKOR', CH_TABLE) {} BKORChunkHandler() : ChunkHandler('BKOR', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+1 -1
View File
@@ -19,7 +19,7 @@ static const SaveLoad _randomizer_desc[] = {
}; };
struct SRNDChunkHandler : ChunkHandler { struct SRNDChunkHandler : ChunkHandler {
SRNDChunkHandler() : ChunkHandler('SRND', CH_TABLE) SRNDChunkHandler() : ChunkHandler('SRND', ChunkType::Table)
{} {}
void Save() const override void Save() const override
+51 -51
View File
@@ -196,7 +196,7 @@ struct MemoryDumper {
struct SaveLoadParams { struct SaveLoadParams {
SaveLoadAction action; ///< are we doing a save or a load atm. SaveLoadAction action; ///< are we doing a save or a load atm.
NeedLength need_length; ///< working in NeedLength (Autolength) mode? NeedLength need_length; ///< working in NeedLength (Autolength) mode?
uint8_t block_mode; ///< ??? ChunkType chunk_type; ///< The type of chunk we are reading or writing.
bool error; ///< did an error occur or not bool error; ///< did an error occur or not
size_t obj_len; ///< the length of the current object we are busy with size_t obj_len; ///< the length of the current object we are busy with
@@ -707,11 +707,11 @@ int SlIterateArray()
} }
int index; int index;
switch (_sl.block_mode) { switch (_sl.chunk_type) {
case CH_SPARSE_TABLE: case ChunkType::SparseTable:
case CH_SPARSE_ARRAY: index = static_cast<int>(SlReadSparseIndex()); break; case ChunkType::SparseArray: index = static_cast<int>(SlReadSparseIndex()); break;
case CH_TABLE: case ChunkType::Table:
case CH_ARRAY: index = _sl.array_index++; break; case ChunkType::Array: index = _sl.array_index++; break;
default: default:
Debug(sl, 0, "SlIterateArray error"); Debug(sl, 0, "SlIterateArray error");
return -1; // error return -1; // error
@@ -743,30 +743,30 @@ void SlSetLength(size_t length)
switch (_sl.need_length) { switch (_sl.need_length) {
case NL_WANTLENGTH: case NL_WANTLENGTH:
_sl.need_length = NL_NONE; _sl.need_length = NL_NONE;
if ((_sl.block_mode == CH_TABLE || _sl.block_mode == CH_SPARSE_TABLE) && _sl.expect_table_header) { if ((_sl.chunk_type == ChunkType::Table || _sl.chunk_type == ChunkType::SparseTable) && _sl.expect_table_header) {
_sl.expect_table_header = false; _sl.expect_table_header = false;
SlWriteArrayLength(length + 1); SlWriteArrayLength(length + 1);
break; break;
} }
switch (_sl.block_mode) { switch (_sl.chunk_type) {
case CH_RIFF: case ChunkType::Riff:
/* Ugly encoding of >16M RIFF chunks /* Ugly encoding of >16M RIFF chunks
* The lower 24 bits are normal * The lower 24 bits are normal
* The uppermost 4 bits are bits 24:27 */ * The uppermost 4 bits are bits 24:27 */
assert(length < (1 << 28)); assert(length < (1 << 28));
SlWriteUint32((uint32_t)((length & 0xFFFFFF) | ((length >> 24) << 28))); SlWriteUint32((uint32_t)((length & 0xFFFFFF) | ((length >> 24) << 28)));
break; break;
case CH_TABLE: case ChunkType::Table:
case CH_ARRAY: case ChunkType::Array:
assert(_sl.last_array_index <= _sl.array_index); assert(_sl.last_array_index <= _sl.array_index);
while (++_sl.last_array_index <= _sl.array_index) { while (++_sl.last_array_index <= _sl.array_index) {
SlWriteArrayLength(1); SlWriteArrayLength(1);
} }
SlWriteArrayLength(length + 1); SlWriteArrayLength(length + 1);
break; break;
case CH_SPARSE_TABLE: case ChunkType::SparseTable:
case CH_SPARSE_ARRAY: case ChunkType::SparseArray:
SlWriteArrayLength(length + 1 + SlGetArrayLength(_sl.array_index)); // Also include length of sparse index. SlWriteArrayLength(length + 1 + SlGetArrayLength(_sl.array_index)); // Also include length of sparse index.
SlWriteSparseIndex(_sl.array_index); SlWriteSparseIndex(_sl.array_index);
break; break;
@@ -1880,8 +1880,8 @@ class SlSkipHandler : public SaveLoadHandler {
*/ */
std::vector<SaveLoad> SlTableHeader(const SaveLoadTable &slt) std::vector<SaveLoad> SlTableHeader(const SaveLoadTable &slt)
{ {
/* You can only use SlTableHeader if you are a CH_TABLE. */ /* You can only use SlTableHeader if you are a ChunkType::Table or ChunkType::SparseTable. */
assert(_sl.block_mode == CH_TABLE || _sl.block_mode == CH_SPARSE_TABLE); assert(_sl.chunk_type == ChunkType::Table || _sl.chunk_type == ChunkType::SparseTable);
switch (_sl.action) { switch (_sl.action) {
case SLA_LOAD_CHECK: case SLA_LOAD_CHECK:
@@ -2019,8 +2019,8 @@ std::vector<SaveLoad> SlTableHeader(const SaveLoadTable &slt)
std::vector<SaveLoad> SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct) std::vector<SaveLoad> SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct)
{ {
assert(_sl.action == SLA_LOAD || _sl.action == SLA_LOAD_CHECK); assert(_sl.action == SLA_LOAD || _sl.action == SLA_LOAD_CHECK);
/* CH_TABLE / CH_SPARSE_TABLE always have a header. */ /* ChunkType::Table / ChunkType::SparseTable always have a header. */
if (_sl.block_mode == CH_TABLE || _sl.block_mode == CH_SPARSE_TABLE) return SlTableHeader(slt); if (_sl.chunk_type == ChunkType::Table || _sl.chunk_type == ChunkType::SparseTable) return SlTableHeader(slt);
std::vector<SaveLoad> saveloads; std::vector<SaveLoad> saveloads;
@@ -2106,16 +2106,16 @@ void SlAutolength(AutolengthProc *proc, int arg)
void ChunkHandler::LoadCheck(size_t len) const void ChunkHandler::LoadCheck(size_t len) const
{ {
switch (_sl.block_mode) { switch (_sl.chunk_type) {
case CH_TABLE: case ChunkType::Table:
case CH_SPARSE_TABLE: case ChunkType::SparseTable:
SlTableHeader({}); SlTableHeader({});
[[fallthrough]]; [[fallthrough]];
case CH_ARRAY: case ChunkType::Array:
case CH_SPARSE_ARRAY: case ChunkType::SparseArray:
SlSkipArray(); SlSkipArray();
break; break;
case CH_RIFF: case ChunkType::Riff:
SlSkipBytes(len); SlSkipBytes(len);
break; break;
default: default:
@@ -2131,9 +2131,9 @@ static void SlLoadChunk(const ChunkHandler &ch)
{ {
uint8_t m = SlReadByte(); uint8_t m = SlReadByte();
_sl.block_mode = m & CH_TYPE_MASK; _sl.chunk_type = static_cast<ChunkType>(m & to_underlying(ChunkType::FileTypeMask));
_sl.obj_len = 0; _sl.obj_len = 0;
_sl.expect_table_header = (_sl.block_mode == CH_TABLE || _sl.block_mode == CH_SPARSE_TABLE); _sl.expect_table_header = (_sl.chunk_type == ChunkType::Table || _sl.chunk_type == ChunkType::SparseTable);
/* The header should always be at the start. Read the length; the /* The header should always be at the start. Read the length; the
* Load() should as first action process the header. */ * Load() should as first action process the header. */
@@ -2141,19 +2141,19 @@ static void SlLoadChunk(const ChunkHandler &ch)
if (SlIterateArray() != INT32_MAX) SlErrorCorrupt("Table chunk without header"); if (SlIterateArray() != INT32_MAX) SlErrorCorrupt("Table chunk without header");
} }
switch (_sl.block_mode) { switch (_sl.chunk_type) {
case CH_TABLE: case ChunkType::Table:
case CH_ARRAY: case ChunkType::Array:
_sl.array_index = 0; _sl.array_index = 0;
ch.Load(); ch.Load();
if (_next_offs != 0) SlErrorCorrupt("Invalid array length"); if (_next_offs != 0) SlErrorCorrupt("Invalid array length");
break; break;
case CH_SPARSE_TABLE: case ChunkType::SparseTable:
case CH_SPARSE_ARRAY: case ChunkType::SparseArray:
ch.Load(); ch.Load();
if (_next_offs != 0) SlErrorCorrupt("Invalid array length"); if (_next_offs != 0) SlErrorCorrupt("Invalid array length");
break; break;
case CH_RIFF: { case ChunkType::Riff: {
/* Read length */ /* Read length */
size_t len = (SlReadByte() << 16) | ((m >> 4) << 24); size_t len = (SlReadByte() << 16) | ((m >> 4) << 24);
len += SlReadUint16(); len += SlReadUint16();
@@ -2184,9 +2184,9 @@ static void SlLoadCheckChunk(const ChunkHandler &ch)
{ {
uint8_t m = SlReadByte(); uint8_t m = SlReadByte();
_sl.block_mode = m & CH_TYPE_MASK; _sl.chunk_type = static_cast<ChunkType>(m & to_underlying(ChunkType::FileTypeMask));
_sl.obj_len = 0; _sl.obj_len = 0;
_sl.expect_table_header = (_sl.block_mode == CH_TABLE || _sl.block_mode == CH_SPARSE_TABLE); _sl.expect_table_header = (_sl.chunk_type == ChunkType::Table || _sl.chunk_type == ChunkType::SparseTable);
/* The header should always be at the start. Read the length; the /* The header should always be at the start. Read the length; the
* LoadCheck() should as first action process the header. */ * LoadCheck() should as first action process the header. */
@@ -2194,17 +2194,17 @@ static void SlLoadCheckChunk(const ChunkHandler &ch)
if (SlIterateArray() != INT32_MAX) SlErrorCorrupt("Table chunk without header"); if (SlIterateArray() != INT32_MAX) SlErrorCorrupt("Table chunk without header");
} }
switch (_sl.block_mode) { switch (_sl.chunk_type) {
case CH_TABLE: case ChunkType::Table:
case CH_ARRAY: case ChunkType::Array:
_sl.array_index = 0; _sl.array_index = 0;
ch.LoadCheck(); ch.LoadCheck();
break; break;
case CH_SPARSE_TABLE: case ChunkType::SparseTable:
case CH_SPARSE_ARRAY: case ChunkType::SparseArray:
ch.LoadCheck(); ch.LoadCheck();
break; break;
case CH_RIFF: { case ChunkType::Riff: {
/* Read length */ /* Read length */
size_t len = (SlReadByte() << 16) | ((m >> 4) << 24); size_t len = (SlReadByte() << 16) | ((m >> 4) << 24);
len += SlReadUint16(); len += SlReadUint16();
@@ -2233,30 +2233,30 @@ static void SlLoadCheckChunk(const ChunkHandler &ch)
*/ */
static void SlSaveChunk(const ChunkHandler &ch) static void SlSaveChunk(const ChunkHandler &ch)
{ {
if (ch.type == CH_READONLY) return; if (ch.type == ChunkType::ReadOnly) return;
SlWriteUint32(ch.id); SlWriteUint32(ch.id);
Debug(sl, 2, "Saving chunk {}", ch.GetName()); Debug(sl, 2, "Saving chunk {}", ch.GetName());
_sl.block_mode = ch.type; _sl.chunk_type = ch.type;
_sl.expect_table_header = (_sl.block_mode == CH_TABLE || _sl.block_mode == CH_SPARSE_TABLE); _sl.expect_table_header = (_sl.chunk_type == ChunkType::Table || _sl.chunk_type == ChunkType::SparseTable);
_sl.need_length = (_sl.expect_table_header || _sl.block_mode == CH_RIFF) ? NL_WANTLENGTH : NL_NONE; _sl.need_length = (_sl.expect_table_header || _sl.chunk_type == ChunkType::Riff) ? NL_WANTLENGTH : NL_NONE;
switch (_sl.block_mode) { switch (_sl.chunk_type) {
case CH_RIFF: case ChunkType::Riff:
ch.Save(); ch.Save();
break; break;
case CH_TABLE: case ChunkType::Table:
case CH_ARRAY: case ChunkType::Array:
_sl.last_array_index = 0; _sl.last_array_index = 0;
SlWriteByte(_sl.block_mode); SlWriteByte(to_underlying(_sl.chunk_type));
ch.Save(); ch.Save();
SlWriteArrayLength(0); // Terminate arrays SlWriteArrayLength(0); // Terminate arrays
break; break;
case CH_SPARSE_TABLE: case ChunkType::SparseTable:
case CH_SPARSE_ARRAY: case ChunkType::SparseArray:
SlWriteByte(_sl.block_mode); SlWriteByte(to_underlying(_sl.chunk_type));
ch.Save(); ch.Save();
SlWriteArrayLength(0); // Terminate arrays SlWriteArrayLength(0); // Terminate arrays
break; break;
+11 -11
View File
@@ -329,9 +329,9 @@ enum class SaveLoadVersion : uint16_t {
GroupReplaceWagonRemoval, ///< Saveload version: 291, GitHub pull request: 7441\n Per-group wagon removal flag. GroupReplaceWagonRemoval, ///< Saveload version: 291, GitHub pull request: 7441\n Per-group wagon removal flag.
CustomSubsidyDuration, ///< Saveload version: 292, GitHub pull request: 9081\n Configurable subsidy duration. CustomSubsidyDuration, ///< Saveload version: 292, GitHub pull request: 9081\n Configurable subsidy duration.
SaveloadListLength, ///< Saveload version: 293, GitHub pull request: 9374\n Consistency in list length with SaveLoadType::Struct / SaveLoadType::StructList / SaveLoadType::ReferenceList. SaveloadListLength, ///< Saveload version: 293, GitHub pull request: 9374\n Consistency in list length with SaveLoadType::Struct / SaveLoadType::StructList / SaveLoadType::ReferenceList.
RiffToArray, ///< Saveload version: 294, GitHub pull request: 9375\n Changed many CH_RIFF chunks to CH_ARRAY chunks. RiffToArray, ///< Saveload version: 294, GitHub pull request: 9375\n Changed many ChunkType::Riff chunks to ChunkType::Array chunks.
TableChunks, ///< Saveload version: 295, GitHub pull request: 9322\n Introduction of CH_TABLE and CH_SPARSE_TABLE. TableChunks, ///< Saveload version: 295, GitHub pull request: 9322\n Introduction of ChunkType::Table and ChunkType::SparseTable.
ScriptInt64, ///< Saveload version: 296, GitHub pull request: 9415\n SQInteger is 64bit but was saved as 32bit. ScriptInt64, ///< Saveload version: 296, GitHub pull request: 9415\n SQInteger is 64bit but was saved as 32bit.
LinkgraphTravelTime, ///< Saveload version: 297, GitHub pull request: 9457, release: 12.0-RC1\n Store travel time in the linkgraph. LinkgraphTravelTime, ///< Saveload version: 297, GitHub pull request: 9457, release: 12.0-RC1\n Store travel time in the linkgraph.
DockDockingtiles, ///< Saveload version: 298, GitHub pull request: 9578\n All tiles around docks may be docking tiles. DockDockingtiles, ///< Saveload version: 298, GitHub pull request: 9578\n All tiles around docks may be docking tiles.
@@ -467,15 +467,15 @@ SaveLoadResult LoadWithFilter(std::shared_ptr<struct LoadFilter> reader);
typedef void AutolengthProc(int); typedef void AutolengthProc(int);
/** Type of a chunk. */ /** Type of a chunk. */
enum ChunkType : uint8_t { enum class ChunkType : uint8_t {
CH_RIFF = 0, Riff = 0, ///< 4 bits store the chunk type, 28 bits the number of bytes.
CH_ARRAY = 1, Array = 1, ///< Contiguous array of elements starting at index 0.
CH_SPARSE_ARRAY = 2, SparseArray = 2, ///< Array of elements with index for each element.
CH_TABLE = 3, Table = 3, ///< An \c Array with a header describing the elements.
CH_SPARSE_TABLE = 4, SparseTable = 4, ///< A \c SparseArray with a header describing the elements.
CH_TYPE_MASK = 0xf, ///< All ChunkType values have to be within this mask. FileTypeMask = 0xf, ///< All ChunkType values that are saved in the file have to be within this mask.
CH_READONLY, ///< Chunk is never saved. ReadOnly, ///< Chunk is never saved.
}; };
/** Handlers and description of chunk. */ /** Handlers and description of chunk. */
@@ -490,7 +490,7 @@ struct ChunkHandler {
/** /**
* Save the chunk. * Save the chunk.
* Must be overridden, unless Chunk type is CH_READONLY. * Must be overridden, unless Chunk type is ChunkType::ReadOnly.
*/ */
virtual void Save() const { NOT_REACHED(); } virtual void Save() const { NOT_REACHED(); }
+2 -2
View File
@@ -142,7 +142,7 @@ static void SaveSettings(const SettingTable &settings, void *object)
} }
struct OPTSChunkHandler : ChunkHandler { struct OPTSChunkHandler : ChunkHandler {
OPTSChunkHandler() : ChunkHandler('OPTS', CH_READONLY) {} OPTSChunkHandler() : ChunkHandler('OPTS', ChunkType::ReadOnly) {}
void Load() const override void Load() const override
{ {
@@ -156,7 +156,7 @@ struct OPTSChunkHandler : ChunkHandler {
}; };
struct PATSChunkHandler : ChunkHandler { struct PATSChunkHandler : ChunkHandler {
PATSChunkHandler() : ChunkHandler('PATS', CH_TABLE) {} PATSChunkHandler() : ChunkHandler('PATS', ChunkType::Table) {}
void Load() const override void Load() const override
{ {
+1 -1
View File
@@ -32,7 +32,7 @@ static const SaveLoad _sign_desc[] = {
}; };
struct SIGNChunkHandler : ChunkHandler { struct SIGNChunkHandler : ChunkHandler {
SIGNChunkHandler() : ChunkHandler('SIGN', CH_TABLE) {} SIGNChunkHandler() : ChunkHandler('SIGN', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+3 -3
View File
@@ -531,7 +531,7 @@ static const SaveLoad _old_station_desc[] = {
}; };
struct STNSChunkHandler : ChunkHandler { struct STNSChunkHandler : ChunkHandler {
STNSChunkHandler() : ChunkHandler('STNS', CH_READONLY) {} STNSChunkHandler() : ChunkHandler('STNS', ChunkType::ReadOnly) {}
void Load() const override void Load() const override
{ {
@@ -722,7 +722,7 @@ static const SaveLoad _station_desc[] = {
}; };
struct STNNChunkHandler : ChunkHandler { struct STNNChunkHandler : ChunkHandler {
STNNChunkHandler() : ChunkHandler('STNN', CH_TABLE) {} STNNChunkHandler() : ChunkHandler('STNN', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
@@ -765,7 +765,7 @@ struct STNNChunkHandler : ChunkHandler {
}; };
struct ROADChunkHandler : ChunkHandler { struct ROADChunkHandler : ChunkHandler {
ROADChunkHandler() : ChunkHandler('ROAD', CH_TABLE) {} ROADChunkHandler() : ChunkHandler('ROAD', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+1 -1
View File
@@ -25,7 +25,7 @@ static const SaveLoad _storage_desc[] = {
/** Persistent storage data. */ /** Persistent storage data. */
struct PSACChunkHandler : ChunkHandler { struct PSACChunkHandler : ChunkHandler {
PSACChunkHandler() : ChunkHandler('PSAC', CH_TABLE) {} PSACChunkHandler() : ChunkHandler('PSAC', ChunkType::Table) {}
void Load() const override void Load() const override
{ {
+2 -2
View File
@@ -39,7 +39,7 @@ static const SaveLoad _story_page_elements_desc[] = {
}; };
struct STPEChunkHandler : ChunkHandler { struct STPEChunkHandler : ChunkHandler {
STPEChunkHandler() : ChunkHandler('STPE', CH_TABLE) {} STPEChunkHandler() : ChunkHandler('STPE', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
@@ -81,7 +81,7 @@ static const SaveLoad _story_pages_desc[] = {
}; };
struct STPAChunkHandler : ChunkHandler { struct STPAChunkHandler : ChunkHandler {
STPAChunkHandler() : ChunkHandler('STPA', CH_TABLE) {} STPAChunkHandler() : ChunkHandler('STPA', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+1 -1
View File
@@ -111,7 +111,7 @@ void InitializeOldNames()
} }
struct NAMEChunkHandler : ChunkHandler { struct NAMEChunkHandler : ChunkHandler {
NAMEChunkHandler() : ChunkHandler('NAME', CH_READONLY) {} NAMEChunkHandler() : ChunkHandler('NAME', ChunkType::ReadOnly) {}
void Load() const override void Load() const override
{ {
+1 -1
View File
@@ -30,7 +30,7 @@ static const SaveLoad _subsidies_desc[] = {
}; };
struct SUBSChunkHandler : ChunkHandler { struct SUBSChunkHandler : ChunkHandler {
SUBSChunkHandler() : ChunkHandler('SUBS', CH_TABLE) {} SUBSChunkHandler() : ChunkHandler('SUBS', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+1 -1
View File
@@ -374,7 +374,7 @@ struct HIDSChunkHandler : NewGRFMappingChunkHandler {
}; };
struct CITYChunkHandler : ChunkHandler { struct CITYChunkHandler : ChunkHandler {
CITYChunkHandler() : ChunkHandler('CITY', CH_TABLE) {} CITYChunkHandler() : ChunkHandler('CITY', ChunkType::Table) {}
void Save() const override void Save() const override
{ {
+1 -1
View File
@@ -1114,7 +1114,7 @@ static const SaveLoad _vehicle_desc[] = {
}; };
struct VEHSChunkHandler : ChunkHandler { struct VEHSChunkHandler : ChunkHandler {
VEHSChunkHandler() : ChunkHandler('VEHS', CH_SPARSE_TABLE) {} VEHSChunkHandler() : ChunkHandler('VEHS', ChunkType::SparseTable) {}
void Save() const override void Save() const override
{ {
+1 -1
View File
@@ -17,7 +17,7 @@ extern void SlSkipArray();
/** Water Region savegame data is no longer used, but still needed for old savegames to load without errors. */ /** Water Region savegame data is no longer used, but still needed for old savegames to load without errors. */
struct WaterRegionChunkHandler : ChunkHandler { struct WaterRegionChunkHandler : ChunkHandler {
WaterRegionChunkHandler() : ChunkHandler('WRGN', CH_READONLY) WaterRegionChunkHandler() : ChunkHandler('WRGN', ChunkType::ReadOnly)
{} {}
void Load() const override void Load() const override
+1 -1
View File
@@ -186,7 +186,7 @@ static const SaveLoad _old_waypoint_desc[] = {
}; };
struct CHKPChunkHandler : ChunkHandler { struct CHKPChunkHandler : ChunkHandler {
CHKPChunkHandler() : ChunkHandler('CHKP', CH_READONLY) {} CHKPChunkHandler() : ChunkHandler('CHKP', ChunkType::ReadOnly) {}
void Load() const override void Load() const override
{ {