Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
This commit is contained in:
@@ -2271,7 +2271,7 @@ bool AfterLoadGame()
|
||||
* So taking the 16 bit fractional part into account there are plenty of bits left
|
||||
* for unmodified savegames ...
|
||||
*/
|
||||
uint64 aimed_inflation = (_economy.old_max_loan_unround << 16 | _economy.old_max_loan_unround_fract) / _settings_game.difficulty.max_loan;
|
||||
uint64_t aimed_inflation = (_economy.old_max_loan_unround << 16 | _economy.old_max_loan_unround_fract) / _settings_game.difficulty.max_loan;
|
||||
|
||||
/* ... well, just clamp it then. */
|
||||
if (aimed_inflation > MAX_INFLATION) aimed_inflation = MAX_INFLATION;
|
||||
@@ -2708,7 +2708,7 @@ bool AfterLoadGame()
|
||||
_settings_game.pf.reverse_at_signals = IsSavegameVersionBefore(SLV_100) || (_settings_game.pf.wait_oneway_signal != 255 && _settings_game.pf.wait_twoway_signal != 255 && _settings_game.pf.wait_for_pbs_path != 255);
|
||||
|
||||
for (Train *t : Train::Iterate()) {
|
||||
_settings_game.vehicle.max_train_length = std::max<uint8>(_settings_game.vehicle.max_train_length, CeilDiv(t->gcache.cached_total_length, TILE_SIZE));
|
||||
_settings_game.vehicle.max_train_length = std::max<uint8_t>(_settings_game.vehicle.max_train_length, CeilDiv(t->gcache.cached_total_length, TILE_SIZE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2851,7 +2851,7 @@ bool AfterLoadGame()
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(SLV_178)) {
|
||||
extern uint8 _old_diff_level;
|
||||
extern uint8_t _old_diff_level;
|
||||
/* Initialise script settings profile */
|
||||
_settings_game.script.settings_profile = IsInsideMM(_old_diff_level, SP_BEGIN, SP_END) ? _old_diff_level : (uint)SP_MEDIUM;
|
||||
}
|
||||
@@ -2876,7 +2876,7 @@ bool AfterLoadGame()
|
||||
|
||||
if (IsSavegameVersionBefore(SLV_184)) {
|
||||
/* The global units configuration is split up in multiple configurations. */
|
||||
extern uint8 _old_units;
|
||||
extern uint8_t _old_units;
|
||||
_settings_game.locale.units_velocity = Clamp(_old_units, 0, 2);
|
||||
_settings_game.locale.units_power = Clamp(_old_units, 0, 2);
|
||||
_settings_game.locale.units_weight = Clamp(_old_units, 1, 2);
|
||||
@@ -3134,7 +3134,7 @@ bool AfterLoadGame()
|
||||
if (IsSavegameVersionBefore(SLV_GROUP_REPLACE_WAGON_REMOVAL)) {
|
||||
/* Propagate wagon removal flag for compatibility */
|
||||
/* Temporary bitmask of company wagon removal setting */
|
||||
uint16 wagon_removal = 0;
|
||||
uint16_t wagon_removal = 0;
|
||||
for (const Company *c : Company::Iterate()) {
|
||||
if (c->settings.renew_keep_length) SetBit(wagon_removal, c->index);
|
||||
}
|
||||
@@ -3151,7 +3151,7 @@ bool AfterLoadGame()
|
||||
/* Use current order time to approximate last loading time */
|
||||
if (IsSavegameVersionBefore(SLV_LAST_LOADING_TICK)) {
|
||||
for (Vehicle *v : Vehicle::Iterate()) {
|
||||
v->last_loading_tick = std::max(TimerGameTick::counter, static_cast<uint64>(v->current_order_time)) - v->current_order_time;
|
||||
v->last_loading_tick = std::max(TimerGameTick::counter, static_cast<uint64_t>(v->current_order_time)) - v->current_order_time;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
/** Temporary storage of cargo monitoring data for loading or saving it. */
|
||||
struct TempStorage {
|
||||
CargoMonitorID number;
|
||||
uint32 amount;
|
||||
uint32_t amount;
|
||||
};
|
||||
|
||||
/** Description of the #TempStorage structure for the purpose of load and save. */
|
||||
@@ -81,7 +81,7 @@ struct CMDLChunkHandler : ChunkHandler {
|
||||
|
||||
if (fix) storage.number = FixupCargoMonitor(storage.number);
|
||||
|
||||
std::pair<CargoMonitorID, uint32> p(storage.number, storage.amount);
|
||||
std::pair<CargoMonitorID, uint32_t> p(storage.number, storage.amount);
|
||||
_cargo_deliveries.insert(p);
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ struct CMPUChunkHandler : ChunkHandler {
|
||||
|
||||
if (fix) storage.number = FixupCargoMonitor(storage.number);
|
||||
|
||||
std::pair<CargoMonitorID, uint32> p(storage.number, storage.amount);
|
||||
std::pair<CargoMonitorID, uint32_t> p(storage.number, storage.amount);
|
||||
_cargo_pickups.insert(p);
|
||||
}
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@
|
||||
* @param face the face in the old format
|
||||
* @return the face in the new format
|
||||
*/
|
||||
CompanyManagerFace ConvertFromOldCompanyManagerFace(uint32 face)
|
||||
CompanyManagerFace ConvertFromOldCompanyManagerFace(uint32_t face)
|
||||
{
|
||||
CompanyManagerFace cmf = 0;
|
||||
GenderEthnicity ge = GE_WM;
|
||||
@@ -240,7 +240,7 @@ void AfterLoadCompanyStats()
|
||||
|
||||
/* We do need to read this single value, as the bigger it gets, the more data is stored */
|
||||
struct CompanyOldAI {
|
||||
uint8 num_build_rec;
|
||||
uint8_t num_build_rec;
|
||||
};
|
||||
|
||||
class SlCompanyOldAIBuildRec : public DefaultSaveLoadHandler<SlCompanyOldAIBuildRec, CompanyOldAI> {
|
||||
@@ -364,7 +364,7 @@ public:
|
||||
void Load(CompanyProperties *c) const override
|
||||
{
|
||||
if (!IsSavegameVersionBefore(SLV_SAVELOAD_LIST_LENGTH)) {
|
||||
c->num_valid_stat_ent = (uint8)SlGetStructListLength(UINT8_MAX);
|
||||
c->num_valid_stat_ent = (uint8_t)SlGetStructListLength(UINT8_MAX);
|
||||
}
|
||||
if (c->num_valid_stat_ent > lengthof(c->old_economy)) SlErrorCorrupt("Too many old economy entries");
|
||||
|
||||
|
@@ -23,7 +23,7 @@ struct PRICChunkHandler : ChunkHandler {
|
||||
|
||||
void Load() const override
|
||||
{
|
||||
/* Old games store 49 base prices, very old games store them as int32 */
|
||||
/* Old games store 49 base prices, very old games store them as int32_t */
|
||||
int vt = IsSavegameVersionBefore(SLV_65) ? SLE_FILE_I32 : SLE_FILE_I64;
|
||||
SlCopy(nullptr, 49, vt | SLE_VAR_NULL);
|
||||
SlCopy(nullptr, 49, SLE_FILE_U16 | SLE_VAR_NULL);
|
||||
|
@@ -50,7 +50,7 @@ static std::vector<Engine*> _temp_engine;
|
||||
*/
|
||||
static Engine* CallocEngine()
|
||||
{
|
||||
uint8 *zero = CallocT<uint8>(sizeof(Engine));
|
||||
uint8_t *zero = CallocT<uint8_t>(sizeof(Engine));
|
||||
Engine *engine = new (zero) Engine();
|
||||
return engine;
|
||||
}
|
||||
|
@@ -119,7 +119,7 @@ struct GSDTChunkHandler : ChunkHandler {
|
||||
extern GameStrings *_current_data;
|
||||
|
||||
static std::string _game_saveload_string;
|
||||
static uint32 _game_saveload_strings;
|
||||
static uint32_t _game_saveload_strings;
|
||||
|
||||
class SlGameLanguageString : public DefaultSaveLoadHandler<SlGameLanguageString, LanguageStrings> {
|
||||
public:
|
||||
@@ -140,9 +140,9 @@ public:
|
||||
|
||||
void Load(LanguageStrings *ls) const override
|
||||
{
|
||||
uint32 length = IsSavegameVersionBefore(SLV_SAVELOAD_LIST_LENGTH) ? _game_saveload_strings : (uint32)SlGetStructListLength(UINT32_MAX);
|
||||
uint32_t length = IsSavegameVersionBefore(SLV_SAVELOAD_LIST_LENGTH) ? _game_saveload_strings : (uint32_t)SlGetStructListLength(UINT32_MAX);
|
||||
|
||||
for (uint32 i = 0; i < length; i++) {
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
SlObject(nullptr, this->GetLoadDescription());
|
||||
ls->lines.emplace_back(_game_saveload_string);
|
||||
}
|
||||
|
@@ -92,7 +92,7 @@ void ResetLabelMaps()
|
||||
|
||||
/** Container for a label for SaveLoad system */
|
||||
struct LabelObject {
|
||||
uint32 label;
|
||||
uint32_t label;
|
||||
};
|
||||
|
||||
static const SaveLoad _label_object_desc[] = {
|
||||
|
@@ -24,7 +24,7 @@
|
||||
typedef LinkGraph::BaseNode Node;
|
||||
typedef LinkGraph::BaseEdge Edge;
|
||||
|
||||
static uint16 _num_nodes;
|
||||
static uint16_t _num_nodes;
|
||||
static LinkGraph *_linkgraph; ///< Contains the current linkgraph being saved/loaded.
|
||||
static NodeID _linkgraph_from; ///< Contains the current "from" node being saved/loaded.
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
void Load(Node *bn) const override
|
||||
{
|
||||
if (IsSavegameVersionBefore(SLV_LINKGRAPH_EDGES)) {
|
||||
uint16 max_size = _linkgraph->Size();
|
||||
uint16_t max_size = _linkgraph->Size();
|
||||
std::vector<Edge> edges(max_size);
|
||||
|
||||
if (IsSavegameVersionBefore(SLV_191)) {
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
{
|
||||
_linkgraph = lg;
|
||||
|
||||
uint16 length = IsSavegameVersionBefore(SLV_SAVELOAD_LIST_LENGTH) ? _num_nodes : (uint16)SlGetStructListLength(UINT16_MAX);
|
||||
uint16_t length = IsSavegameVersionBefore(SLV_SAVELOAD_LIST_LENGTH) ? _num_nodes : (uint16_t)SlGetStructListLength(UINT16_MAX);
|
||||
lg->Init(length);
|
||||
for (NodeID from = 0; from < length; ++from) {
|
||||
_linkgraph_from = from;
|
||||
|
@@ -18,8 +18,8 @@
|
||||
|
||||
#include "../safeguards.h"
|
||||
|
||||
static uint32 _map_dim_x;
|
||||
static uint32 _map_dim_y;
|
||||
static uint32_t _map_dim_x;
|
||||
static uint32_t _map_dim_y;
|
||||
|
||||
static const SaveLoad _map_desc[] = {
|
||||
SLEG_CONDVAR("dim_x", _map_dim_x, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
@@ -152,7 +152,7 @@ struct MAP2ChunkHandler : ChunkHandler {
|
||||
|
||||
void Load() const override
|
||||
{
|
||||
std::array<uint16, MAP_SL_BUF_SIZE> buf;
|
||||
std::array<uint16_t, MAP_SL_BUF_SIZE> buf;
|
||||
TileIndex size = Map::Size();
|
||||
|
||||
for (TileIndex i = 0; i != size;) {
|
||||
@@ -166,10 +166,10 @@ struct MAP2ChunkHandler : ChunkHandler {
|
||||
|
||||
void Save() const override
|
||||
{
|
||||
std::array<uint16, MAP_SL_BUF_SIZE> buf;
|
||||
std::array<uint16_t, MAP_SL_BUF_SIZE> buf;
|
||||
TileIndex size = Map::Size();
|
||||
|
||||
SlSetLength(size * sizeof(uint16));
|
||||
SlSetLength(size * sizeof(uint16_t));
|
||||
for (TileIndex i = 0; i != size;) {
|
||||
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) buf[j] = Tile(i++).m2();
|
||||
SlCopy(buf.data(), MAP_SL_BUF_SIZE, SLE_UINT16);
|
||||
@@ -330,7 +330,7 @@ struct MAP8ChunkHandler : ChunkHandler {
|
||||
|
||||
void Load() const override
|
||||
{
|
||||
std::array<uint16, MAP_SL_BUF_SIZE> buf;
|
||||
std::array<uint16_t, MAP_SL_BUF_SIZE> buf;
|
||||
TileIndex size = Map::Size();
|
||||
|
||||
for (TileIndex i = 0; i != size;) {
|
||||
@@ -341,10 +341,10 @@ struct MAP8ChunkHandler : ChunkHandler {
|
||||
|
||||
void Save() const override
|
||||
{
|
||||
std::array<uint16, MAP_SL_BUF_SIZE> buf;
|
||||
std::array<uint16_t, MAP_SL_BUF_SIZE> buf;
|
||||
TileIndex size = Map::Size();
|
||||
|
||||
SlSetLength(size * sizeof(uint16));
|
||||
SlSetLength(size * sizeof(uint16_t));
|
||||
for (TileIndex i = 0; i != size;) {
|
||||
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) buf[j] = Tile(i++).m8();
|
||||
SlCopy(buf.data(), MAP_SL_BUF_SIZE, SLE_UINT16);
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#include "../safeguards.h"
|
||||
|
||||
extern TileIndex _cur_tileloop_tile;
|
||||
extern uint16 _disaster_delay;
|
||||
extern uint16_t _disaster_delay;
|
||||
extern byte _trees_tick_ctr;
|
||||
extern std::string _savegame_id;
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
struct NewGRFMappingChunkHandler : ChunkHandler {
|
||||
OverrideManagerBase &mapping;
|
||||
|
||||
NewGRFMappingChunkHandler(uint32 id, OverrideManagerBase &mapping) : ChunkHandler(id, CH_TABLE), mapping(mapping) {}
|
||||
NewGRFMappingChunkHandler(uint32_t id, OverrideManagerBase &mapping) : ChunkHandler(id, CH_TABLE), mapping(mapping) {}
|
||||
void Save() const override;
|
||||
void Load() const override;
|
||||
};
|
||||
|
@@ -27,7 +27,7 @@ static const int TTD_HEADER_SIZE = 49;
|
||||
/** The size of the checksum in the name/header of the TTD/TTO savegames. */
|
||||
static const int HEADER_CHECKSUM_SIZE = 2;
|
||||
|
||||
uint32 _bump_assert_value;
|
||||
uint32_t _bump_assert_value;
|
||||
|
||||
static inline OldChunkType GetOldChunkType(OldChunkType type) {return (OldChunkType)GB(type, 0, 4);}
|
||||
static inline OldChunkType GetOldChunkVarType(OldChunkType type) {return (OldChunkType)(GB(type, 8, 8) << 8);}
|
||||
@@ -83,7 +83,7 @@ byte ReadByte(LoadgameState *ls)
|
||||
|
||||
if (ls->chunk_size == 0) {
|
||||
/* Read new chunk */
|
||||
int8 new_byte = ReadByteFromFile(ls);
|
||||
int8_t new_byte = ReadByteFromFile(ls);
|
||||
|
||||
if (new_byte < 0) {
|
||||
/* Repeat next char for new_byte times */
|
||||
@@ -138,15 +138,15 @@ bool LoadChunk(LoadgameState *ls, void *base, const OldChunks *chunks)
|
||||
default: break;
|
||||
}
|
||||
} else {
|
||||
uint64 res = 0;
|
||||
uint64_t res = 0;
|
||||
|
||||
/* Reading from the file: bits 16 to 23 have the FILE type */
|
||||
switch (GetOldChunkFileType(chunk->type)) {
|
||||
case OC_FILE_I8: res = (int8)ReadByte(ls); break;
|
||||
case OC_FILE_I8: res = (int8_t)ReadByte(ls); break;
|
||||
case OC_FILE_U8: res = ReadByte(ls); break;
|
||||
case OC_FILE_I16: res = (int16)ReadUint16(ls); break;
|
||||
case OC_FILE_I16: res = (int16_t)ReadUint16(ls); break;
|
||||
case OC_FILE_U16: res = ReadUint16(ls); break;
|
||||
case OC_FILE_I32: res = (int32)ReadUint32(ls); break;
|
||||
case OC_FILE_I32: res = (int32_t)ReadUint32(ls); break;
|
||||
case OC_FILE_U32: res = ReadUint32(ls); break;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
@@ -159,14 +159,14 @@ bool LoadChunk(LoadgameState *ls, void *base, const OldChunks *chunks)
|
||||
|
||||
/* Write the data */
|
||||
switch (GetOldChunkVarType(chunk->type)) {
|
||||
case OC_VAR_I8: *(int8 *)ptr = GB(res, 0, 8); break;
|
||||
case OC_VAR_U8: *(uint8 *)ptr = GB(res, 0, 8); break;
|
||||
case OC_VAR_I16:*(int16 *)ptr = GB(res, 0, 16); break;
|
||||
case OC_VAR_U16:*(uint16*)ptr = GB(res, 0, 16); break;
|
||||
case OC_VAR_I32:*(int32 *)ptr = res; break;
|
||||
case OC_VAR_U32:*(uint32*)ptr = res; break;
|
||||
case OC_VAR_I64:*(int64 *)ptr = res; break;
|
||||
case OC_VAR_U64:*(uint64*)ptr = res; break;
|
||||
case OC_VAR_I8: *(int8_t *)ptr = GB(res, 0, 8); break;
|
||||
case OC_VAR_U8: *(uint8_t *)ptr = GB(res, 0, 8); break;
|
||||
case OC_VAR_I16:*(int16_t *)ptr = GB(res, 0, 16); break;
|
||||
case OC_VAR_U16:*(uint16_t*)ptr = GB(res, 0, 16); break;
|
||||
case OC_VAR_I32:*(int32_t *)ptr = res; break;
|
||||
case OC_VAR_U32:*(uint32_t*)ptr = res; break;
|
||||
case OC_VAR_I64:*(int64_t *)ptr = res; break;
|
||||
case OC_VAR_U64:*(uint64_t*)ptr = res; break;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ static void InitLoading(LoadgameState *ls)
|
||||
*/
|
||||
static bool VerifyOldNameChecksum(char *title, uint len)
|
||||
{
|
||||
uint16 sum = 0;
|
||||
uint16_t sum = 0;
|
||||
for (uint i = 0; i < len - HEADER_CHECKSUM_SIZE; i++) {
|
||||
sum += title[i];
|
||||
sum = ROL(sum, 1);
|
||||
@@ -217,7 +217,7 @@ static bool VerifyOldNameChecksum(char *title, uint len)
|
||||
|
||||
sum ^= 0xAAAA; // computed checksum
|
||||
|
||||
uint16 sum2 = title[len - HEADER_CHECKSUM_SIZE]; // checksum in file
|
||||
uint16_t sum2 = title[len - HEADER_CHECKSUM_SIZE]; // checksum in file
|
||||
SB(sum2, 8, 8, title[len - HEADER_CHECKSUM_SIZE + 1]);
|
||||
|
||||
return sum == sum2;
|
||||
|
@@ -86,7 +86,7 @@ typedef void *OffsetProc(void *base);
|
||||
|
||||
struct OldChunks {
|
||||
OldChunkType type; ///< Type of field
|
||||
uint32 amount; ///< Amount of fields
|
||||
uint32_t amount; ///< Amount of fields
|
||||
|
||||
void *ptr; ///< Pointer where to save the data (takes precedence over #offset)
|
||||
OffsetProc *offset; ///< Pointer to function that returns the actual memory address of a member (ignored if #ptr is not nullptr)
|
||||
@@ -103,15 +103,15 @@ bool LoadChunk(LoadgameState *ls, void *base, const OldChunks *chunks);
|
||||
bool LoadTTDMain(LoadgameState *ls);
|
||||
bool LoadTTOMain(LoadgameState *ls);
|
||||
|
||||
static inline uint16 ReadUint16(LoadgameState *ls)
|
||||
static inline uint16_t ReadUint16(LoadgameState *ls)
|
||||
{
|
||||
byte x = ReadByte(ls);
|
||||
return x | ReadByte(ls) << 8;
|
||||
}
|
||||
|
||||
static inline uint32 ReadUint32(LoadgameState *ls)
|
||||
static inline uint32_t ReadUint32(LoadgameState *ls)
|
||||
{
|
||||
uint16 x = ReadUint16(ls);
|
||||
uint16_t x = ReadUint16(ls);
|
||||
return x | ReadUint16(ls) << 16;
|
||||
}
|
||||
|
||||
|
@@ -40,10 +40,10 @@
|
||||
#include "../safeguards.h"
|
||||
|
||||
static bool _read_ttdpatch_flags; ///< Have we (tried to) read TTDPatch extra flags?
|
||||
static uint16 _old_extra_chunk_nums; ///< Number of extra TTDPatch chunks
|
||||
static uint16_t _old_extra_chunk_nums; ///< Number of extra TTDPatch chunks
|
||||
static byte _old_vehicle_multiplier; ///< TTDPatch vehicle multiplier
|
||||
|
||||
static uint8 *_old_map3;
|
||||
static uint8_t *_old_map3;
|
||||
|
||||
void FixOldMapArray()
|
||||
{
|
||||
@@ -121,7 +121,7 @@ static void FixTTDDepots()
|
||||
|
||||
#define FIXNUM(x, y, z) (((((x) << 16) / (y)) + 1) << z)
|
||||
|
||||
static uint32 RemapOldTownName(uint32 townnameparts, byte old_town_name_type)
|
||||
static uint32_t RemapOldTownName(uint32_t townnameparts, byte old_town_name_type)
|
||||
{
|
||||
switch (old_town_name_type) {
|
||||
case 0: case 3: // English, American
|
||||
@@ -494,9 +494,9 @@ extern std::vector<TileIndex> _animated_tiles;
|
||||
extern TimeoutTimer<TimerGameTick> _new_competitor_timeout;
|
||||
extern char *_old_name_array;
|
||||
|
||||
static uint32 _old_town_index;
|
||||
static uint16 _old_string_id;
|
||||
static uint16 _old_string_id_2;
|
||||
static uint32_t _old_town_index;
|
||||
static uint16_t _old_string_id;
|
||||
static uint16_t _old_string_id_2;
|
||||
|
||||
static void ReadTTDPatchFlags()
|
||||
{
|
||||
@@ -613,7 +613,7 @@ static bool LoadOldTown(LoadgameState *ls, int num)
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint16 _old_order;
|
||||
static uint16_t _old_order;
|
||||
static const OldChunks order_chunk[] = {
|
||||
OCL_VAR ( OC_UINT16, 1, &_old_order ),
|
||||
OCL_END()
|
||||
@@ -681,9 +681,9 @@ static bool LoadOldDepot(LoadgameState *ls, int num)
|
||||
}
|
||||
|
||||
static StationID _current_station_id;
|
||||
static uint16 _waiting_acceptance;
|
||||
static uint8 _cargo_source;
|
||||
static uint8 _cargo_periods;
|
||||
static uint16_t _waiting_acceptance;
|
||||
static uint8_t _cargo_source;
|
||||
static uint8_t _cargo_periods;
|
||||
|
||||
static const OldChunks goods_chunk[] = {
|
||||
OCL_VAR ( OC_UINT16, 1, &_waiting_acceptance ),
|
||||
@@ -860,7 +860,7 @@ static bool LoadOldIndustry(LoadgameState *ls, int num)
|
||||
}
|
||||
|
||||
static CompanyID _current_company_id;
|
||||
static int32 _old_yearly;
|
||||
static int32_t _old_yearly;
|
||||
|
||||
static const OldChunks _company_yearly_chunk[] = {
|
||||
OCL_VAR( OC_INT32, 1, &_old_yearly ),
|
||||
@@ -1025,8 +1025,8 @@ static bool LoadOldCompany(LoadgameState *ls, int num)
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint32 _old_order_ptr;
|
||||
static uint16 _old_next_ptr;
|
||||
static uint32_t _old_order_ptr;
|
||||
static uint16_t _old_next_ptr;
|
||||
static VehicleID _current_vehicle_id;
|
||||
|
||||
static const OldChunks vehicle_train_chunk[] = {
|
||||
@@ -1126,7 +1126,7 @@ static bool LoadOldVehicleUnion(LoadgameState *ls, int num)
|
||||
return res;
|
||||
}
|
||||
|
||||
static uint16 _cargo_count;
|
||||
static uint16_t _cargo_count;
|
||||
|
||||
static const OldChunks vehicle_chunk[] = {
|
||||
OCL_SVAR( OC_UINT8, Vehicle, subtype ),
|
||||
@@ -1523,8 +1523,8 @@ static bool LoadTTDPatchExtraChunks(LoadgameState *ls, int num)
|
||||
Debug(oldloader, 2, "Found {} extra chunk(s)", _old_extra_chunk_nums);
|
||||
|
||||
for (int i = 0; i != _old_extra_chunk_nums; i++) {
|
||||
uint16 id = ReadUint16(ls);
|
||||
uint32 len = ReadUint32(ls);
|
||||
uint16_t id = ReadUint16(ls);
|
||||
uint32_t len = ReadUint32(ls);
|
||||
|
||||
switch (id) {
|
||||
/* List of GRFIDs, used in the savegame. 0x8004 is the new ID
|
||||
@@ -1536,7 +1536,7 @@ static bool LoadTTDPatchExtraChunks(LoadgameState *ls, int num)
|
||||
|
||||
ClearGRFConfigList(&_grfconfig);
|
||||
while (len != 0) {
|
||||
uint32 grfid = ReadUint32(ls);
|
||||
uint32_t grfid = ReadUint32(ls);
|
||||
|
||||
if (ReadByte(ls) == 1) {
|
||||
GRFConfig *c = new GRFConfig("TTDP game, no information");
|
||||
@@ -1573,11 +1573,11 @@ static bool LoadTTDPatchExtraChunks(LoadgameState *ls, int num)
|
||||
}
|
||||
|
||||
extern TileIndex _cur_tileloop_tile;
|
||||
extern uint16 _disaster_delay;
|
||||
extern uint16_t _disaster_delay;
|
||||
extern byte _trees_tick_ctr;
|
||||
extern byte _age_cargo_skip_counter; // From misc_sl.cpp
|
||||
extern uint8 _old_diff_level;
|
||||
extern uint8 _old_units;
|
||||
extern uint8_t _old_diff_level;
|
||||
extern uint8_t _old_units;
|
||||
static const OldChunks main_chunk[] = {
|
||||
OCL_ASSERT( OC_TTD, 0 ),
|
||||
OCL_ASSERT( OC_TTO, 0 ),
|
||||
|
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
void Order::ConvertFromOldSavegame()
|
||||
{
|
||||
uint8 old_flags = this->flags;
|
||||
uint8_t old_flags = this->flags;
|
||||
this->flags = 0;
|
||||
|
||||
/* First handle non-stop - use value from savegame if possible, else use value from config file */
|
||||
@@ -79,7 +79,7 @@ void Order::ConvertFromOldSavegame()
|
||||
* @param packed packed order
|
||||
* @return unpacked order
|
||||
*/
|
||||
static Order UnpackVersion4Order(uint16 packed)
|
||||
static Order UnpackVersion4Order(uint16_t packed)
|
||||
{
|
||||
return Order(GB(packed, 8, 8) << 16 | GB(packed, 4, 4) << 8 | GB(packed, 0, 4));
|
||||
}
|
||||
@@ -89,7 +89,7 @@ static Order UnpackVersion4Order(uint16 packed)
|
||||
* @param packed packed order
|
||||
* @return unpacked order
|
||||
*/
|
||||
Order UnpackOldOrder(uint16 packed)
|
||||
Order UnpackOldOrder(uint16_t packed)
|
||||
{
|
||||
Order order = UnpackVersion4Order(packed);
|
||||
|
||||
@@ -141,9 +141,9 @@ struct ORDRChunkHandler : ChunkHandler {
|
||||
|
||||
if (IsSavegameVersionBefore(SLV_5)) {
|
||||
/* Pre-version 5 had another layout for orders
|
||||
* (uint16 instead of uint32) */
|
||||
len /= sizeof(uint16);
|
||||
std::vector<uint16> orders(len);
|
||||
* (uint16_t instead of uint32_t) */
|
||||
len /= sizeof(uint16_t);
|
||||
std::vector<uint16_t> orders(len);
|
||||
|
||||
SlCopy(&orders[0], len, SLE_UINT16);
|
||||
|
||||
@@ -152,8 +152,8 @@ struct ORDRChunkHandler : ChunkHandler {
|
||||
o->AssignOrder(UnpackVersion4Order(orders[i]));
|
||||
}
|
||||
} else if (IsSavegameVersionBefore(SLV_5, 2)) {
|
||||
len /= sizeof(uint32);
|
||||
std::vector<uint32> orders(len);
|
||||
len /= sizeof(uint32_t);
|
||||
std::vector<uint32_t> orders(len);
|
||||
|
||||
SlCopy(&orders[0], len, SLE_UINT32);
|
||||
|
||||
|
@@ -59,7 +59,7 @@ extern const SaveLoadVersion SAVEGAME_VERSION = (SaveLoadVersion)(SL_MAX_VERSION
|
||||
SavegameType _savegame_type; ///< type of savegame we are loading
|
||||
FileToSaveLoad _file_to_saveload; ///< File to save or load in the openttd loop.
|
||||
|
||||
uint32 _ttdp_version; ///< version of TTDP savegame (if applicable)
|
||||
uint32_t _ttdp_version; ///< version of TTDP savegame (if applicable)
|
||||
SaveLoadVersion _sl_version; ///< the major savegame version identifier
|
||||
byte _sl_minor_version; ///< the minor savegame version, DO NOT USE!
|
||||
std::string _savegame_format; ///< how to compress savegames
|
||||
@@ -418,35 +418,35 @@ static inline int SlReadUint16()
|
||||
return x | SlReadByte();
|
||||
}
|
||||
|
||||
static inline uint32 SlReadUint32()
|
||||
static inline uint32_t SlReadUint32()
|
||||
{
|
||||
uint32 x = SlReadUint16() << 16;
|
||||
uint32_t x = SlReadUint16() << 16;
|
||||
return x | SlReadUint16();
|
||||
}
|
||||
|
||||
static inline uint64 SlReadUint64()
|
||||
static inline uint64_t SlReadUint64()
|
||||
{
|
||||
uint32 x = SlReadUint32();
|
||||
uint32 y = SlReadUint32();
|
||||
return (uint64)x << 32 | y;
|
||||
uint32_t x = SlReadUint32();
|
||||
uint32_t y = SlReadUint32();
|
||||
return (uint64_t)x << 32 | y;
|
||||
}
|
||||
|
||||
static inline void SlWriteUint16(uint16 v)
|
||||
static inline void SlWriteUint16(uint16_t v)
|
||||
{
|
||||
SlWriteByte(GB(v, 8, 8));
|
||||
SlWriteByte(GB(v, 0, 8));
|
||||
}
|
||||
|
||||
static inline void SlWriteUint32(uint32 v)
|
||||
static inline void SlWriteUint32(uint32_t v)
|
||||
{
|
||||
SlWriteUint16(GB(v, 16, 16));
|
||||
SlWriteUint16(GB(v, 0, 16));
|
||||
}
|
||||
|
||||
static inline void SlWriteUint64(uint64 x)
|
||||
static inline void SlWriteUint64(uint64_t x)
|
||||
{
|
||||
SlWriteUint32((uint32)(x >> 32));
|
||||
SlWriteUint32((uint32)x);
|
||||
SlWriteUint32((uint32_t)(x >> 32));
|
||||
SlWriteUint32((uint32_t)x);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -558,7 +558,7 @@ static inline uint SlGetArrayLength(size_t length)
|
||||
/**
|
||||
* Return the type as saved/loaded inside the savegame.
|
||||
*/
|
||||
static uint8 GetSavegameFileType(const SaveLoad &sld)
|
||||
static uint8_t GetSavegameFileType(const SaveLoad &sld)
|
||||
{
|
||||
switch (sld.cmd) {
|
||||
case SL_VAR:
|
||||
@@ -603,7 +603,7 @@ static inline uint SlCalcConvMemLen(VarType conv)
|
||||
return SlReadArrayLength();
|
||||
|
||||
default:
|
||||
uint8 type = GetVarMemType(conv) >> 4;
|
||||
uint8_t type = GetVarMemType(conv) >> 4;
|
||||
assert(type < lengthof(conv_mem_size));
|
||||
return conv_mem_size[type];
|
||||
}
|
||||
@@ -619,7 +619,7 @@ static inline byte SlCalcConvFileLen(VarType conv)
|
||||
{
|
||||
static const byte conv_file_size[] = {0, 1, 1, 2, 2, 4, 4, 8, 8, 2};
|
||||
|
||||
uint8 type = GetVarFileType(conv);
|
||||
uint8_t type = GetVarFileType(conv);
|
||||
assert(type < lengthof(conv_file_size));
|
||||
return conv_file_size[type];
|
||||
}
|
||||
@@ -715,7 +715,7 @@ void SlSetLength(size_t length)
|
||||
* The lower 24 bits are normal
|
||||
* The uppermost 4 bits are bits 24:27 */
|
||||
assert(length < (1 << 28));
|
||||
SlWriteUint32((uint32)((length & 0xFFFFFF) | ((length >> 24) << 28)));
|
||||
SlWriteUint32((uint32_t)((length & 0xFFFFFF) | ((length >> 24) << 28)));
|
||||
break;
|
||||
case CH_TABLE:
|
||||
case CH_ARRAY:
|
||||
@@ -777,18 +777,18 @@ size_t SlGetFieldLength()
|
||||
* type, eg one with other flags because it is parsed
|
||||
* @return returns the value of the pointer-setting
|
||||
*/
|
||||
int64 ReadValue(const void *ptr, VarType conv)
|
||||
int64_t ReadValue(const void *ptr, VarType conv)
|
||||
{
|
||||
switch (GetVarMemType(conv)) {
|
||||
case SLE_VAR_BL: return (*(const bool *)ptr != 0);
|
||||
case SLE_VAR_I8: return *(const int8 *)ptr;
|
||||
case SLE_VAR_I8: return *(const int8_t *)ptr;
|
||||
case SLE_VAR_U8: return *(const byte *)ptr;
|
||||
case SLE_VAR_I16: return *(const int16 *)ptr;
|
||||
case SLE_VAR_U16: return *(const uint16*)ptr;
|
||||
case SLE_VAR_I32: return *(const int32 *)ptr;
|
||||
case SLE_VAR_U32: return *(const uint32*)ptr;
|
||||
case SLE_VAR_I64: return *(const int64 *)ptr;
|
||||
case SLE_VAR_U64: return *(const uint64*)ptr;
|
||||
case SLE_VAR_I16: return *(const int16_t *)ptr;
|
||||
case SLE_VAR_U16: return *(const uint16_t*)ptr;
|
||||
case SLE_VAR_I32: return *(const int32_t *)ptr;
|
||||
case SLE_VAR_U32: return *(const uint32_t*)ptr;
|
||||
case SLE_VAR_I64: return *(const int64_t *)ptr;
|
||||
case SLE_VAR_U64: return *(const uint64_t*)ptr;
|
||||
case SLE_VAR_NULL:return 0;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
@@ -801,18 +801,18 @@ int64 ReadValue(const void *ptr, VarType conv)
|
||||
* with other flags. It is parsed upon read
|
||||
* @param val the new value being given to the variable
|
||||
*/
|
||||
void WriteValue(void *ptr, VarType conv, int64 val)
|
||||
void WriteValue(void *ptr, VarType conv, int64_t val)
|
||||
{
|
||||
switch (GetVarMemType(conv)) {
|
||||
case SLE_VAR_BL: *(bool *)ptr = (val != 0); break;
|
||||
case SLE_VAR_I8: *(int8 *)ptr = val; break;
|
||||
case SLE_VAR_I8: *(int8_t *)ptr = val; break;
|
||||
case SLE_VAR_U8: *(byte *)ptr = val; break;
|
||||
case SLE_VAR_I16: *(int16 *)ptr = val; break;
|
||||
case SLE_VAR_U16: *(uint16*)ptr = val; break;
|
||||
case SLE_VAR_I32: *(int32 *)ptr = val; break;
|
||||
case SLE_VAR_U32: *(uint32*)ptr = val; break;
|
||||
case SLE_VAR_I64: *(int64 *)ptr = val; break;
|
||||
case SLE_VAR_U64: *(uint64*)ptr = val; break;
|
||||
case SLE_VAR_I16: *(int16_t *)ptr = val; break;
|
||||
case SLE_VAR_U16: *(uint16_t*)ptr = val; break;
|
||||
case SLE_VAR_I32: *(int32_t *)ptr = val; break;
|
||||
case SLE_VAR_U32: *(uint32_t*)ptr = val; break;
|
||||
case SLE_VAR_I64: *(int64_t *)ptr = val; break;
|
||||
case SLE_VAR_U64: *(uint64_t*)ptr = val; break;
|
||||
case SLE_VAR_NAME: *reinterpret_cast<std::string *>(ptr) = CopyFromOldName(val); break;
|
||||
case SLE_VAR_NULL: break;
|
||||
default: NOT_REACHED();
|
||||
@@ -831,7 +831,7 @@ static void SlSaveLoadConv(void *ptr, VarType conv)
|
||||
{
|
||||
switch (_sl.action) {
|
||||
case SLA_SAVE: {
|
||||
int64 x = ReadValue(ptr, conv);
|
||||
int64_t x = ReadValue(ptr, conv);
|
||||
|
||||
/* Write the value to the file and check if its value is in the desired range */
|
||||
switch (GetVarFileType(conv)) {
|
||||
@@ -841,7 +841,7 @@ static void SlSaveLoadConv(void *ptr, VarType conv)
|
||||
case SLE_FILE_STRINGID:
|
||||
case SLE_FILE_U16:assert(x >= 0 && x <= 65535); SlWriteUint16(x);break;
|
||||
case SLE_FILE_I32:
|
||||
case SLE_FILE_U32: SlWriteUint32((uint32)x);break;
|
||||
case SLE_FILE_U32: SlWriteUint32((uint32_t)x);break;
|
||||
case SLE_FILE_I64:
|
||||
case SLE_FILE_U64: SlWriteUint64(x);break;
|
||||
default: NOT_REACHED();
|
||||
@@ -850,18 +850,18 @@ static void SlSaveLoadConv(void *ptr, VarType conv)
|
||||
}
|
||||
case SLA_LOAD_CHECK:
|
||||
case SLA_LOAD: {
|
||||
int64 x;
|
||||
int64_t x;
|
||||
/* Read a value from the file */
|
||||
switch (GetVarFileType(conv)) {
|
||||
case SLE_FILE_I8: x = (int8 )SlReadByte(); break;
|
||||
case SLE_FILE_I8: x = (int8_t )SlReadByte(); break;
|
||||
case SLE_FILE_U8: x = (byte )SlReadByte(); break;
|
||||
case SLE_FILE_I16: x = (int16 )SlReadUint16(); break;
|
||||
case SLE_FILE_U16: x = (uint16)SlReadUint16(); break;
|
||||
case SLE_FILE_I32: x = (int32 )SlReadUint32(); break;
|
||||
case SLE_FILE_U32: x = (uint32)SlReadUint32(); break;
|
||||
case SLE_FILE_I64: x = (int64 )SlReadUint64(); break;
|
||||
case SLE_FILE_U64: x = (uint64)SlReadUint64(); break;
|
||||
case SLE_FILE_STRINGID: x = RemapOldStringID((uint16)SlReadUint16()); break;
|
||||
case SLE_FILE_I16: x = (int16_t )SlReadUint16(); break;
|
||||
case SLE_FILE_U16: x = (uint16_t)SlReadUint16(); break;
|
||||
case SLE_FILE_I32: x = (int32_t )SlReadUint32(); break;
|
||||
case SLE_FILE_U32: x = (uint32_t)SlReadUint32(); break;
|
||||
case SLE_FILE_I64: x = (int64_t )SlReadUint64(); break;
|
||||
case SLE_FILE_U64: x = (uint64_t)SlReadUint64(); break;
|
||||
case SLE_FILE_STRINGID: x = RemapOldStringID((uint16_t)SlReadUint16()); break;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
|
||||
@@ -904,7 +904,7 @@ static void FixSCCEncoded(std::string &str)
|
||||
size_t len = Utf8EncodedCharLen(str[i]);
|
||||
if (len == 0 || i + len > str.size()) break;
|
||||
|
||||
WChar c;
|
||||
char32_t c;
|
||||
Utf8Decode(&c, &str[i]);
|
||||
if (c == 0xE028 || c == 0xE02A) Utf8Encode(&str[i], SCC_ENCODED);
|
||||
i += len;
|
||||
@@ -984,7 +984,7 @@ static void SlCopyInternal(void *object, size_t length, VarType conv)
|
||||
/* used for conversion of Money 32bit->64bit */
|
||||
if (conv == (SLE_FILE_I32 | SLE_VAR_I64)) {
|
||||
for (uint i = 0; i < length; i++) {
|
||||
((int64*)object)[i] = (int32)BSWAP32(SlReadUint32());
|
||||
((int64_t*)object)[i] = (int32_t)BSWAP32(SlReadUint32());
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1041,7 +1041,7 @@ static inline size_t SlCalcArrayLen(size_t length, VarType conv)
|
||||
* Save/Load the length of the array followed by the array of SL_VAR elements.
|
||||
* @param array The array being manipulated
|
||||
* @param length The length of the array in elements
|
||||
* @param conv VarType type of the atomic array (int, byte, uint64, etc.)
|
||||
* @param conv VarType type of the atomic array (int, byte, uint64_t, etc.)
|
||||
*/
|
||||
static void SlArray(void *array, size_t length, VarType conv)
|
||||
{
|
||||
@@ -1202,7 +1202,7 @@ void SlSaveLoadRef(void *ptr, VarType conv)
|
||||
{
|
||||
switch (_sl.action) {
|
||||
case SLA_SAVE:
|
||||
SlWriteUint32((uint32)ReferenceToInt(*(void **)ptr, (SLRefType)conv));
|
||||
SlWriteUint32((uint32_t)ReferenceToInt(*(void **)ptr, (SLRefType)conv));
|
||||
break;
|
||||
case SLA_LOAD_CHECK:
|
||||
case SLA_LOAD:
|
||||
@@ -1341,14 +1341,14 @@ static inline size_t SlCalcDequeLen(const void *deque, VarType conv)
|
||||
{
|
||||
switch (GetVarMemType(conv)) {
|
||||
case SLE_VAR_BL: return SlStorageHelper<std::deque, bool>::SlCalcLen(deque, conv);
|
||||
case SLE_VAR_I8: return SlStorageHelper<std::deque, int8>::SlCalcLen(deque, conv);
|
||||
case SLE_VAR_U8: return SlStorageHelper<std::deque, uint8>::SlCalcLen(deque, conv);
|
||||
case SLE_VAR_I16: return SlStorageHelper<std::deque, int16>::SlCalcLen(deque, conv);
|
||||
case SLE_VAR_U16: return SlStorageHelper<std::deque, uint16>::SlCalcLen(deque, conv);
|
||||
case SLE_VAR_I32: return SlStorageHelper<std::deque, int32>::SlCalcLen(deque, conv);
|
||||
case SLE_VAR_U32: return SlStorageHelper<std::deque, uint32>::SlCalcLen(deque, conv);
|
||||
case SLE_VAR_I64: return SlStorageHelper<std::deque, int64>::SlCalcLen(deque, conv);
|
||||
case SLE_VAR_U64: return SlStorageHelper<std::deque, uint64>::SlCalcLen(deque, conv);
|
||||
case SLE_VAR_I8: return SlStorageHelper<std::deque, int8_t>::SlCalcLen(deque, conv);
|
||||
case SLE_VAR_U8: return SlStorageHelper<std::deque, uint8_t>::SlCalcLen(deque, conv);
|
||||
case SLE_VAR_I16: return SlStorageHelper<std::deque, int16_t>::SlCalcLen(deque, conv);
|
||||
case SLE_VAR_U16: return SlStorageHelper<std::deque, uint16_t>::SlCalcLen(deque, conv);
|
||||
case SLE_VAR_I32: return SlStorageHelper<std::deque, int32_t>::SlCalcLen(deque, conv);
|
||||
case SLE_VAR_U32: return SlStorageHelper<std::deque, uint32_t>::SlCalcLen(deque, conv);
|
||||
case SLE_VAR_I64: return SlStorageHelper<std::deque, int64_t>::SlCalcLen(deque, conv);
|
||||
case SLE_VAR_U64: return SlStorageHelper<std::deque, uint64_t>::SlCalcLen(deque, conv);
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
}
|
||||
@@ -1362,14 +1362,14 @@ static void SlDeque(void *deque, VarType conv)
|
||||
{
|
||||
switch (GetVarMemType(conv)) {
|
||||
case SLE_VAR_BL: SlStorageHelper<std::deque, bool>::SlSaveLoad(deque, conv); break;
|
||||
case SLE_VAR_I8: SlStorageHelper<std::deque, int8>::SlSaveLoad(deque, conv); break;
|
||||
case SLE_VAR_U8: SlStorageHelper<std::deque, uint8>::SlSaveLoad(deque, conv); break;
|
||||
case SLE_VAR_I16: SlStorageHelper<std::deque, int16>::SlSaveLoad(deque, conv); break;
|
||||
case SLE_VAR_U16: SlStorageHelper<std::deque, uint16>::SlSaveLoad(deque, conv); break;
|
||||
case SLE_VAR_I32: SlStorageHelper<std::deque, int32>::SlSaveLoad(deque, conv); break;
|
||||
case SLE_VAR_U32: SlStorageHelper<std::deque, uint32>::SlSaveLoad(deque, conv); break;
|
||||
case SLE_VAR_I64: SlStorageHelper<std::deque, int64>::SlSaveLoad(deque, conv); break;
|
||||
case SLE_VAR_U64: SlStorageHelper<std::deque, uint64>::SlSaveLoad(deque, conv); break;
|
||||
case SLE_VAR_I8: SlStorageHelper<std::deque, int8_t>::SlSaveLoad(deque, conv); break;
|
||||
case SLE_VAR_U8: SlStorageHelper<std::deque, uint8_t>::SlSaveLoad(deque, conv); break;
|
||||
case SLE_VAR_I16: SlStorageHelper<std::deque, int16_t>::SlSaveLoad(deque, conv); break;
|
||||
case SLE_VAR_U16: SlStorageHelper<std::deque, uint16_t>::SlSaveLoad(deque, conv); break;
|
||||
case SLE_VAR_I32: SlStorageHelper<std::deque, int32_t>::SlSaveLoad(deque, conv); break;
|
||||
case SLE_VAR_U32: SlStorageHelper<std::deque, uint32_t>::SlSaveLoad(deque, conv); break;
|
||||
case SLE_VAR_I64: SlStorageHelper<std::deque, int64_t>::SlSaveLoad(deque, conv); break;
|
||||
case SLE_VAR_U64: SlStorageHelper<std::deque, uint64_t>::SlSaveLoad(deque, conv); break;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
}
|
||||
@@ -1383,14 +1383,14 @@ static inline size_t SlCalcVectorLen(const void *vector, VarType conv)
|
||||
{
|
||||
switch (GetVarMemType(conv)) {
|
||||
case SLE_VAR_BL: NOT_REACHED(); // Not supported
|
||||
case SLE_VAR_I8: return SlStorageHelper<std::vector, int8>::SlCalcLen(vector, conv);
|
||||
case SLE_VAR_U8: return SlStorageHelper<std::vector, uint8>::SlCalcLen(vector, conv);
|
||||
case SLE_VAR_I16: return SlStorageHelper<std::vector, int16>::SlCalcLen(vector, conv);
|
||||
case SLE_VAR_U16: return SlStorageHelper<std::vector, uint16>::SlCalcLen(vector, conv);
|
||||
case SLE_VAR_I32: return SlStorageHelper<std::vector, int32>::SlCalcLen(vector, conv);
|
||||
case SLE_VAR_U32: return SlStorageHelper<std::vector, uint32>::SlCalcLen(vector, conv);
|
||||
case SLE_VAR_I64: return SlStorageHelper<std::vector, int64>::SlCalcLen(vector, conv);
|
||||
case SLE_VAR_U64: return SlStorageHelper<std::vector, uint64>::SlCalcLen(vector, conv);
|
||||
case SLE_VAR_I8: return SlStorageHelper<std::vector, int8_t>::SlCalcLen(vector, conv);
|
||||
case SLE_VAR_U8: return SlStorageHelper<std::vector, uint8_t>::SlCalcLen(vector, conv);
|
||||
case SLE_VAR_I16: return SlStorageHelper<std::vector, int16_t>::SlCalcLen(vector, conv);
|
||||
case SLE_VAR_U16: return SlStorageHelper<std::vector, uint16_t>::SlCalcLen(vector, conv);
|
||||
case SLE_VAR_I32: return SlStorageHelper<std::vector, int32_t>::SlCalcLen(vector, conv);
|
||||
case SLE_VAR_U32: return SlStorageHelper<std::vector, uint32_t>::SlCalcLen(vector, conv);
|
||||
case SLE_VAR_I64: return SlStorageHelper<std::vector, int64_t>::SlCalcLen(vector, conv);
|
||||
case SLE_VAR_U64: return SlStorageHelper<std::vector, uint64_t>::SlCalcLen(vector, conv);
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
}
|
||||
@@ -1404,14 +1404,14 @@ static void SlVector(void *vector, VarType conv)
|
||||
{
|
||||
switch (GetVarMemType(conv)) {
|
||||
case SLE_VAR_BL: NOT_REACHED(); // Not supported
|
||||
case SLE_VAR_I8: SlStorageHelper<std::vector, int8>::SlSaveLoad(vector, conv); break;
|
||||
case SLE_VAR_U8: SlStorageHelper<std::vector, uint8>::SlSaveLoad(vector, conv); break;
|
||||
case SLE_VAR_I16: SlStorageHelper<std::vector, int16>::SlSaveLoad(vector, conv); break;
|
||||
case SLE_VAR_U16: SlStorageHelper<std::vector, uint16>::SlSaveLoad(vector, conv); break;
|
||||
case SLE_VAR_I32: SlStorageHelper<std::vector, int32>::SlSaveLoad(vector, conv); break;
|
||||
case SLE_VAR_U32: SlStorageHelper<std::vector, uint32>::SlSaveLoad(vector, conv); break;
|
||||
case SLE_VAR_I64: SlStorageHelper<std::vector, int64>::SlSaveLoad(vector, conv); break;
|
||||
case SLE_VAR_U64: SlStorageHelper<std::vector, uint64>::SlSaveLoad(vector, conv); break;
|
||||
case SLE_VAR_I8: SlStorageHelper<std::vector, int8_t>::SlSaveLoad(vector, conv); break;
|
||||
case SLE_VAR_U8: SlStorageHelper<std::vector, uint8_t>::SlSaveLoad(vector, conv); break;
|
||||
case SLE_VAR_I16: SlStorageHelper<std::vector, int16_t>::SlSaveLoad(vector, conv); break;
|
||||
case SLE_VAR_U16: SlStorageHelper<std::vector, uint16_t>::SlSaveLoad(vector, conv); break;
|
||||
case SLE_VAR_I32: SlStorageHelper<std::vector, int32_t>::SlSaveLoad(vector, conv); break;
|
||||
case SLE_VAR_U32: SlStorageHelper<std::vector, uint32_t>::SlSaveLoad(vector, conv); break;
|
||||
case SLE_VAR_I64: SlStorageHelper<std::vector, int64_t>::SlSaveLoad(vector, conv); break;
|
||||
case SLE_VAR_U64: SlStorageHelper<std::vector, uint64_t>::SlSaveLoad(vector, conv); break;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
}
|
||||
@@ -1529,16 +1529,16 @@ size_t SlCalcObjMemberLength(const void *object, const SaveLoad &sld)
|
||||
return sld.size == sizeof(bool);
|
||||
case SLE_VAR_I8:
|
||||
case SLE_VAR_U8:
|
||||
return sld.size == sizeof(int8);
|
||||
return sld.size == sizeof(int8_t);
|
||||
case SLE_VAR_I16:
|
||||
case SLE_VAR_U16:
|
||||
return sld.size == sizeof(int16);
|
||||
return sld.size == sizeof(int16_t);
|
||||
case SLE_VAR_I32:
|
||||
case SLE_VAR_U32:
|
||||
return sld.size == sizeof(int32);
|
||||
return sld.size == sizeof(int32_t);
|
||||
case SLE_VAR_I64:
|
||||
case SLE_VAR_U64:
|
||||
return sld.size == sizeof(int64);
|
||||
return sld.size == sizeof(int64_t);
|
||||
case SLE_VAR_NAME:
|
||||
return sld.size == sizeof(std::string);
|
||||
default:
|
||||
@@ -1594,7 +1594,7 @@ static bool SlObjectMember(void *object, const SaveLoad &sld)
|
||||
void *ptr = GetVariableAddress(object, sld);
|
||||
|
||||
switch (_sl.action) {
|
||||
case SLA_SAVE: SlWriteByte(*(uint8 *)ptr); break;
|
||||
case SLA_SAVE: SlWriteByte(*(uint8_t *)ptr); break;
|
||||
case SLA_LOAD_CHECK:
|
||||
case SLA_LOAD:
|
||||
case SLA_PTRS:
|
||||
@@ -1767,7 +1767,7 @@ std::vector<SaveLoad> SlTableHeader(const SaveLoadTable &slt)
|
||||
}
|
||||
|
||||
while (true) {
|
||||
uint8 type;
|
||||
uint8_t type;
|
||||
SlSaveLoadConv(&type, SLE_UINT8);
|
||||
if (type == SLE_FILE_END) break;
|
||||
|
||||
@@ -1808,7 +1808,7 @@ std::vector<SaveLoad> SlTableHeader(const SaveLoadTable &slt)
|
||||
* conversion. If this error triggers, that clearly didn't
|
||||
* happen and this is a friendly poke to the developer to bump
|
||||
* the savegame version and add conversion code. */
|
||||
uint8 correct_type = GetSavegameFileType(*sld_it->second);
|
||||
uint8_t correct_type = GetSavegameFileType(*sld_it->second);
|
||||
if (correct_type != type) {
|
||||
Debug(sl, 1, "Field type for '{}' was expected to be 0x{:02x} but 0x{:02x} was found", key, correct_type, type);
|
||||
SlErrorCorrupt("Field type is different than expected");
|
||||
@@ -1837,7 +1837,7 @@ std::vector<SaveLoad> SlTableHeader(const SaveLoadTable &slt)
|
||||
/* Make sure we are not storing empty keys. */
|
||||
assert(!sld.name.empty());
|
||||
|
||||
uint8 type = GetSavegameFileType(sld);
|
||||
uint8_t type = GetSavegameFileType(sld);
|
||||
assert(type != SLE_FILE_END);
|
||||
|
||||
SlSaveLoadConv(&type, SLE_UINT8);
|
||||
@@ -1845,7 +1845,7 @@ std::vector<SaveLoad> SlTableHeader(const SaveLoadTable &slt)
|
||||
}
|
||||
|
||||
/* Add an end-of-header marker. */
|
||||
uint8 type = SLE_FILE_END;
|
||||
uint8_t type = SLE_FILE_END;
|
||||
SlSaveLoadConv(&type, SLE_UINT8);
|
||||
|
||||
/* After the table, write down any sub-tables we might have. */
|
||||
@@ -2151,7 +2151,7 @@ static void SlSaveChunks()
|
||||
* @param id the chunk in question
|
||||
* @return returns the appropriate chunkhandler
|
||||
*/
|
||||
static const ChunkHandler *SlFindChunkHandler(uint32 id)
|
||||
static const ChunkHandler *SlFindChunkHandler(uint32_t id)
|
||||
{
|
||||
for (const ChunkHandler &ch : ChunkHandlers()) if (ch.id == id) return &ch;
|
||||
return nullptr;
|
||||
@@ -2160,7 +2160,7 @@ static const ChunkHandler *SlFindChunkHandler(uint32 id)
|
||||
/** Load all chunks */
|
||||
static void SlLoadChunks()
|
||||
{
|
||||
uint32 id;
|
||||
uint32_t id;
|
||||
const ChunkHandler *ch;
|
||||
|
||||
for (id = SlReadUint32(); id != 0; id = SlReadUint32()) {
|
||||
@@ -2175,7 +2175,7 @@ static void SlLoadChunks()
|
||||
/** Load all chunks for savegame checking */
|
||||
static void SlLoadCheckChunks()
|
||||
{
|
||||
uint32 id;
|
||||
uint32_t id;
|
||||
const ChunkHandler *ch;
|
||||
|
||||
for (id = SlReadUint32(); id != 0; id = SlReadUint32()) {
|
||||
@@ -2303,16 +2303,16 @@ struct LZOLoadFilter : LoadFilter {
|
||||
assert(ssize >= LZO_BUFFER_SIZE);
|
||||
|
||||
/* Buffer size is from the LZO docs plus the chunk header size. */
|
||||
byte out[LZO_BUFFER_SIZE + LZO_BUFFER_SIZE / 16 + 64 + 3 + sizeof(uint32) * 2];
|
||||
uint32 tmp[2];
|
||||
uint32 size;
|
||||
byte out[LZO_BUFFER_SIZE + LZO_BUFFER_SIZE / 16 + 64 + 3 + sizeof(uint32_t) * 2];
|
||||
uint32_t tmp[2];
|
||||
uint32_t size;
|
||||
lzo_uint len = ssize;
|
||||
|
||||
/* Read header*/
|
||||
if (this->chain->Read((byte*)tmp, sizeof(tmp)) != sizeof(tmp)) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE, "File read failed");
|
||||
|
||||
/* Check if size is bad */
|
||||
((uint32*)out)[0] = size = tmp[1];
|
||||
((uint32_t*)out)[0] = size = tmp[1];
|
||||
|
||||
if (_sl_version != SL_MIN_VERSION) {
|
||||
tmp[0] = TO_BE32(tmp[0]);
|
||||
@@ -2322,13 +2322,13 @@ struct LZOLoadFilter : LoadFilter {
|
||||
if (size >= sizeof(out)) SlErrorCorrupt("Inconsistent size");
|
||||
|
||||
/* Read block */
|
||||
if (this->chain->Read(out + sizeof(uint32), size) != size) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE);
|
||||
if (this->chain->Read(out + sizeof(uint32_t), size) != size) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE);
|
||||
|
||||
/* Verify checksum */
|
||||
if (tmp[0] != lzo_adler32(0, out, size + sizeof(uint32))) SlErrorCorrupt("Bad checksum");
|
||||
if (tmp[0] != lzo_adler32(0, out, size + sizeof(uint32_t))) SlErrorCorrupt("Bad checksum");
|
||||
|
||||
/* Decompress */
|
||||
int ret = lzo1x_decompress_safe(out + sizeof(uint32) * 1, size, buf, &len, nullptr);
|
||||
int ret = lzo1x_decompress_safe(out + sizeof(uint32_t) * 1, size, buf, &len, nullptr);
|
||||
if (ret != LZO_E_OK) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE);
|
||||
return len;
|
||||
}
|
||||
@@ -2350,17 +2350,17 @@ struct LZOSaveFilter : SaveFilter {
|
||||
{
|
||||
const lzo_bytep in = buf;
|
||||
/* Buffer size is from the LZO docs plus the chunk header size. */
|
||||
byte out[LZO_BUFFER_SIZE + LZO_BUFFER_SIZE / 16 + 64 + 3 + sizeof(uint32) * 2];
|
||||
byte out[LZO_BUFFER_SIZE + LZO_BUFFER_SIZE / 16 + 64 + 3 + sizeof(uint32_t) * 2];
|
||||
byte wrkmem[LZO1X_1_MEM_COMPRESS];
|
||||
lzo_uint outlen;
|
||||
|
||||
do {
|
||||
/* Compress up to LZO_BUFFER_SIZE bytes at once. */
|
||||
lzo_uint len = size > LZO_BUFFER_SIZE ? LZO_BUFFER_SIZE : (lzo_uint)size;
|
||||
lzo1x_1_compress(in, len, out + sizeof(uint32) * 2, &outlen, wrkmem);
|
||||
((uint32*)out)[1] = TO_BE32((uint32)outlen);
|
||||
((uint32*)out)[0] = TO_BE32(lzo_adler32(0, out + sizeof(uint32), outlen + sizeof(uint32)));
|
||||
this->chain->Write(out, outlen + sizeof(uint32) * 2);
|
||||
lzo1x_1_compress(in, len, out + sizeof(uint32_t) * 2, &outlen, wrkmem);
|
||||
((uint32_t*)out)[1] = TO_BE32((uint32_t)outlen);
|
||||
((uint32_t*)out)[0] = TO_BE32(lzo_adler32(0, out + sizeof(uint32_t), outlen + sizeof(uint32_t)));
|
||||
this->chain->Write(out, outlen + sizeof(uint32_t) * 2);
|
||||
|
||||
/* Move to next data chunk. */
|
||||
size -= len;
|
||||
@@ -2655,7 +2655,7 @@ struct LZMASaveFilter : SaveFilter {
|
||||
/** The format for a reader/writer type of a savegame */
|
||||
struct SaveLoadFormat {
|
||||
const char *name; ///< name of the compressor/decompressor (debug-only)
|
||||
uint32 tag; ///< the 4-letter tag by which it is identified in the savegame
|
||||
uint32_t tag; ///< the 4-letter tag by which it is identified in the savegame
|
||||
|
||||
LoadFilter *(*init_load)(LoadFilter *chain); ///< Constructor for the load filter.
|
||||
SaveFilter *(*init_write)(SaveFilter *chain, byte compression); ///< Constructor for the save filter.
|
||||
@@ -2834,7 +2834,7 @@ static SaveOrLoadResult SaveFileToDisk(bool threaded)
|
||||
const SaveLoadFormat *fmt = GetSavegameFormat(_savegame_format, &compression);
|
||||
|
||||
/* We have written our stuff to memory, now write it to file! */
|
||||
uint32 hdr[2] = { fmt->tag, TO_BE32(SAVEGAME_VERSION << 16) };
|
||||
uint32_t hdr[2] = { fmt->tag, TO_BE32(SAVEGAME_VERSION << 16) };
|
||||
_sl.sf->Write((byte*)hdr, sizeof(hdr));
|
||||
|
||||
_sl.sf = fmt->init_write(_sl.sf, compression);
|
||||
@@ -2945,7 +2945,7 @@ static SaveOrLoadResult DoLoad(LoadFilter *reader, bool load_check)
|
||||
_load_check_data.checkable = true;
|
||||
}
|
||||
|
||||
uint32 hdr[2];
|
||||
uint32_t hdr[2];
|
||||
if (_sl.lf->Read((byte*)hdr, sizeof(hdr)) != sizeof(hdr)) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE);
|
||||
|
||||
/* see if we have any loader for this type. */
|
||||
|
@@ -28,7 +28,7 @@
|
||||
*
|
||||
* Note that this list must not be reordered.
|
||||
*/
|
||||
enum SaveLoadVersion : uint16 {
|
||||
enum SaveLoadVersion : uint16_t {
|
||||
SL_MIN_VERSION, ///< First savegame version
|
||||
|
||||
SLV_1, ///< 1.0 0.1.x, 0.2.x
|
||||
@@ -282,7 +282,7 @@ enum SaveLoadVersion : uint16 {
|
||||
SLV_198, ///< 198 PR#6763 Switch town growth rate and counter to actual game ticks
|
||||
SLV_EXTEND_CARGOTYPES, ///< 199 PR#6802 Extend cargotypes to 64
|
||||
|
||||
SLV_EXTEND_RAILTYPES, ///< 200 PR#6805 Extend railtypes to 64, adding uint16 to map array.
|
||||
SLV_EXTEND_RAILTYPES, ///< 200 PR#6805 Extend railtypes to 64, adding uint16_t to map array.
|
||||
SLV_EXTEND_PERSISTENT_STORAGE, ///< 201 PR#6885 Extend NewGRF persistent storages.
|
||||
SLV_EXTEND_INDUSTRY_CARGO_SLOTS, ///< 202 PR#6867 Increase industry cargo slots to 16 in, 16 out
|
||||
SLV_SHIP_PATH_CACHE, ///< 203 PR#7072 Add path cache for ships
|
||||
@@ -342,7 +342,7 @@ enum SaveLoadVersion : uint16 {
|
||||
SLV_LAST_LOADING_TICK, ///< 301 PR#9693 Store tick of last loading for vehicles.
|
||||
SLV_MULTITRACK_LEVEL_CROSSINGS, ///< 302 PR#9931 v13.0 Multi-track level crossings.
|
||||
SLV_NEWGRF_ROAD_STOPS, ///< 303 PR#10144 NewGRF road stops.
|
||||
SLV_LINKGRAPH_EDGES, ///< 304 PR#10314 Explicitly store link graph edges destination, PR#10471 int64 instead of uint64 league rating
|
||||
SLV_LINKGRAPH_EDGES, ///< 304 PR#10314 Explicitly store link graph edges destination, PR#10471 int64_t instead of uint64_t league rating
|
||||
|
||||
SLV_VELOCITY_NAUTICAL, ///< 305 PR#10594 Separation of land and nautical velocity (knots!)
|
||||
SLV_CONSISTENT_PARTIAL_Z, ///< 306 PR#10570 Conversion from an inconsistent partial Z calculation for slopes, to one that is (more) consistent.
|
||||
@@ -423,10 +423,10 @@ enum ChunkType {
|
||||
|
||||
/** Handlers and description of chunk. */
|
||||
struct ChunkHandler {
|
||||
uint32 id; ///< Unique ID (4 letters).
|
||||
uint32_t id; ///< Unique ID (4 letters).
|
||||
ChunkType type; ///< Type of the chunk. @see ChunkType
|
||||
|
||||
ChunkHandler(uint32 id, ChunkType type) : id(id), type(type) {}
|
||||
ChunkHandler(uint32_t id, ChunkType type) : id(id), type(type) {}
|
||||
|
||||
virtual ~ChunkHandler() = default;
|
||||
|
||||
@@ -651,7 +651,7 @@ enum VarTypes {
|
||||
SLF_ALLOW_NEWLINE = 1 << 9, ///< Allow new lines in the strings.
|
||||
};
|
||||
|
||||
typedef uint32 VarType;
|
||||
typedef uint32_t VarType;
|
||||
|
||||
/** Type of data saved. */
|
||||
enum SaveLoadType : byte {
|
||||
@@ -678,7 +678,7 @@ struct SaveLoad {
|
||||
std::string name; ///< Name of this field (optional, used for tables).
|
||||
SaveLoadType cmd; ///< The action to take with the saved/loaded type, All types need different action.
|
||||
VarType conv; ///< Type of the variable to be saved; this field combines both FileVarType and MemVarType.
|
||||
uint16 length; ///< (Conditional) length of the variable (eg. arrays) (max array size is 65536 elements).
|
||||
uint16_t length; ///< (Conditional) length of the variable (eg. arrays) (max array size is 65536 elements).
|
||||
SaveLoadVersion version_from; ///< Save/load the variable starting from this savegame version.
|
||||
SaveLoadVersion version_to; ///< Save/load the variable before this savegame version.
|
||||
size_t size; ///< The sizeof size.
|
||||
@@ -697,7 +697,7 @@ struct SaveLoad {
|
||||
*/
|
||||
struct SaveLoadCompat {
|
||||
std::string name; ///< Name of the field.
|
||||
uint16 length; ///< Length of the NULL field.
|
||||
uint16_t length; ///< Length of the NULL field.
|
||||
SaveLoadVersion version_from; ///< Save/load the variable starting from this savegame version.
|
||||
SaveLoadVersion version_to; ///< Save/load the variable before this savegame version.
|
||||
};
|
||||
@@ -1176,8 +1176,8 @@ static inline void *GetVariableAddress(const void *object, const SaveLoad &sld)
|
||||
return sld.address_proc(const_cast<void *>(object), sld.extra_data);
|
||||
}
|
||||
|
||||
int64 ReadValue(const void *ptr, VarType conv);
|
||||
void WriteValue(void *ptr, VarType conv, int64 val);
|
||||
int64_t ReadValue(const void *ptr, VarType conv);
|
||||
void WriteValue(void *ptr, VarType conv, int64_t val);
|
||||
|
||||
void SlSetArrayIndex(uint index);
|
||||
int SlIterateArray();
|
||||
|
@@ -47,15 +47,15 @@ void ResetTempEngineData();
|
||||
Engine *GetTempDataEngine(EngineID index);
|
||||
void CopyTempEngineData();
|
||||
|
||||
extern int32 _saved_scrollpos_x;
|
||||
extern int32 _saved_scrollpos_y;
|
||||
extern int32_t _saved_scrollpos_x;
|
||||
extern int32_t _saved_scrollpos_y;
|
||||
extern ZoomLevel _saved_scrollpos_zoom;
|
||||
|
||||
extern SavegameType _savegame_type;
|
||||
extern uint32 _ttdp_version;
|
||||
extern uint32_t _ttdp_version;
|
||||
|
||||
CompanyManagerFace ConvertFromOldCompanyManagerFace(uint32 face);
|
||||
CompanyManagerFace ConvertFromOldCompanyManagerFace(uint32_t face);
|
||||
|
||||
Order UnpackOldOrder(uint16 packed);
|
||||
Order UnpackOldOrder(uint16_t packed);
|
||||
|
||||
#endif /* SAVELOAD_INTERNAL_H */
|
||||
|
@@ -63,7 +63,7 @@ void HandleOldDiffCustom(bool savegame)
|
||||
continue;
|
||||
}
|
||||
|
||||
int32 value = (int32)((name == "max_loan" ? 1000 : 1) * _old_diff_custom[i++]);
|
||||
int32_t value = (int32_t)((name == "max_loan" ? 1000 : 1) * _old_diff_custom[i++]);
|
||||
sd->AsIntSetting()->MakeValueValidAndWrite(savegame ? &_settings_game : &_settings_newgame, value);
|
||||
}
|
||||
}
|
||||
|
@@ -158,21 +158,21 @@ static const SaveLoad _roadstop_desc[] = {
|
||||
SLE_REF(RoadStop, next, REF_ROADSTOPS),
|
||||
};
|
||||
|
||||
static uint16 _waiting_acceptance;
|
||||
static uint32 _old_num_flows;
|
||||
static uint16 _cargo_source;
|
||||
static uint32 _cargo_source_xy;
|
||||
static uint8 _cargo_periods;
|
||||
static uint16_t _waiting_acceptance;
|
||||
static uint32_t _old_num_flows;
|
||||
static uint16_t _cargo_source;
|
||||
static uint32_t _cargo_source_xy;
|
||||
static uint8_t _cargo_periods;
|
||||
static Money _cargo_feeder_share;
|
||||
|
||||
std::list<CargoPacket *> _packets;
|
||||
uint32 _old_num_dests;
|
||||
uint32_t _old_num_dests;
|
||||
|
||||
struct FlowSaveLoad {
|
||||
FlowSaveLoad() : source(0), via(0), share(0), restricted(false) {}
|
||||
StationID source;
|
||||
StationID via;
|
||||
uint32 share;
|
||||
uint32_t share;
|
||||
bool restricted;
|
||||
};
|
||||
|
||||
@@ -211,7 +211,7 @@ public:
|
||||
};
|
||||
inline const static SaveLoadCompatTable compat_description = _station_spec_list_sl_compat;
|
||||
|
||||
static uint8 last_num_specs; ///< Number of specs of the last loaded station.
|
||||
static uint8_t last_num_specs; ///< Number of specs of the last loaded station.
|
||||
|
||||
void Save(BaseStation *bst) const override
|
||||
{
|
||||
@@ -223,7 +223,7 @@ public:
|
||||
|
||||
void Load(BaseStation *bst) const override
|
||||
{
|
||||
uint8 num_specs = IsSavegameVersionBefore(SLV_SAVELOAD_LIST_LENGTH) ? last_num_specs : (uint8)SlGetStructListLength(UINT8_MAX);
|
||||
uint8_t num_specs = IsSavegameVersionBefore(SLV_SAVELOAD_LIST_LENGTH) ? last_num_specs : (uint8_t)SlGetStructListLength(UINT8_MAX);
|
||||
|
||||
bst->speclist.resize(num_specs);
|
||||
for (uint i = 0; i < num_specs; i++) {
|
||||
@@ -232,7 +232,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
uint8 SlStationSpecList::last_num_specs;
|
||||
uint8_t SlStationSpecList::last_num_specs;
|
||||
|
||||
class SlRoadStopSpecList : public DefaultSaveLoadHandler<SlRoadStopSpecList, BaseStation> {
|
||||
public:
|
||||
@@ -253,7 +253,7 @@ public:
|
||||
|
||||
void Load(BaseStation *bst) const override
|
||||
{
|
||||
uint8 num_specs = (uint8)SlGetStructListLength(UINT8_MAX);
|
||||
uint8_t num_specs = (uint8_t)SlGetStructListLength(UINT8_MAX);
|
||||
|
||||
bst->roadstop_speclist.resize(num_specs);
|
||||
for (uint i = 0; i < num_specs; i++) {
|
||||
@@ -318,7 +318,7 @@ public:
|
||||
|
||||
for (const auto &outer_it : ge->flows) {
|
||||
const FlowStat::SharesMap *shares = outer_it.second.GetShares();
|
||||
uint32 sum_shares = 0;
|
||||
uint32_t sum_shares = 0;
|
||||
FlowSaveLoad flow;
|
||||
flow.source = outer_it.first;
|
||||
for (auto &inner_it : *shares) {
|
||||
@@ -339,7 +339,7 @@ public:
|
||||
FlowSaveLoad flow;
|
||||
FlowStat *fs = nullptr;
|
||||
StationID prev_source = INVALID_STATION;
|
||||
for (uint32 j = 0; j < num_flows; ++j) {
|
||||
for (uint32_t j = 0; j < num_flows; ++j) {
|
||||
SlObject(&flow, this->GetLoadDescription());
|
||||
if (fs == nullptr || prev_source != flow.source) {
|
||||
fs = &(ge->flows.insert(std::make_pair(flow.source, FlowStat(flow.via, flow.share, flow.restricted))).first->second);
|
||||
@@ -563,7 +563,7 @@ public:
|
||||
};
|
||||
inline const static SaveLoadCompatTable compat_description = {};
|
||||
|
||||
static uint8 last_num_specs; ///< Number of specs of the last loaded station.
|
||||
static uint8_t last_num_specs; ///< Number of specs of the last loaded station.
|
||||
|
||||
void Save(BaseStation *bst) const override
|
||||
{
|
||||
@@ -575,7 +575,7 @@ public:
|
||||
|
||||
void Load(BaseStation *bst) const override
|
||||
{
|
||||
uint32 num_tiles = (uint32)SlGetStructListLength(UINT32_MAX);
|
||||
uint32_t num_tiles = (uint32_t)SlGetStructListLength(UINT32_MAX);
|
||||
bst->custom_roadstop_tile_data.resize(num_tiles);
|
||||
for (uint i = 0; i < num_tiles; i++) {
|
||||
SlObject(&bst->custom_roadstop_tile_data[i], this->GetLoadDescription());
|
||||
|
@@ -56,7 +56,7 @@ struct STPEChunkHandler : ChunkHandler {
|
||||
const std::vector<SaveLoad> slt = SlCompatTableHeader(_story_page_elements_desc, _story_page_elements_sl_compat);
|
||||
|
||||
int index;
|
||||
uint32 max_sort_value = 0;
|
||||
uint32_t max_sort_value = 0;
|
||||
while ((index = SlIterateArray()) != -1) {
|
||||
StoryPageElement *s = new (index) StoryPageElement();
|
||||
SlObject(s, slt);
|
||||
@@ -98,7 +98,7 @@ struct STPAChunkHandler : ChunkHandler {
|
||||
const std::vector<SaveLoad> slt = SlCompatTableHeader(_story_pages_desc, _story_pages_sl_compat);
|
||||
|
||||
int index;
|
||||
uint32 max_sort_value = 0;
|
||||
uint32_t max_sort_value = 0;
|
||||
while ((index = SlIterateArray()) != -1) {
|
||||
StoryPage *s = new (index) StoryPage();
|
||||
SlObject(s, slt);
|
||||
|
@@ -70,7 +70,7 @@ std::string CopyFromOldName(StringID id)
|
||||
std::ostringstream tmp;
|
||||
std::ostreambuf_iterator<char> strto(tmp);
|
||||
for (; *strfrom != '\0'; strfrom++) {
|
||||
WChar c = (byte)*strfrom;
|
||||
char32_t c = (byte)*strfrom;
|
||||
|
||||
/* Map from non-ISO8859-15 characters to UTF-8. */
|
||||
switch (c) {
|
||||
|
@@ -118,10 +118,10 @@ void UpdateHousesAndTowns()
|
||||
class SlTownSupplied : public DefaultSaveLoadHandler<SlTownSupplied, Town> {
|
||||
public:
|
||||
inline static const SaveLoad description[] = {
|
||||
SLE_CONDVAR(TransportedCargoStat<uint32>, old_max, SLE_UINT32, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint32>, new_max, SLE_UINT32, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint32>, old_act, SLE_UINT32, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint32>, new_act, SLE_UINT32, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint32_t>, old_max, SLE_UINT32, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint32_t>, new_max, SLE_UINT32, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint32_t>, old_act, SLE_UINT32, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint32_t>, new_act, SLE_UINT32, SLV_165, SL_MAX_VERSION),
|
||||
};
|
||||
inline const static SaveLoadCompatTable compat_description = _town_supplied_sl_compat;
|
||||
|
||||
@@ -157,10 +157,10 @@ public:
|
||||
class SlTownReceived : public DefaultSaveLoadHandler<SlTownReceived, Town> {
|
||||
public:
|
||||
inline static const SaveLoad description[] = {
|
||||
SLE_CONDVAR(TransportedCargoStat<uint16>, old_max, SLE_UINT16, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint16>, new_max, SLE_UINT16, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint16>, old_act, SLE_UINT16, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint16>, new_act, SLE_UINT16, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint16_t>, old_max, SLE_UINT16, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint16_t>, new_max, SLE_UINT16, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint16_t>, old_act, SLE_UINT16, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint16_t>, new_act, SLE_UINT16, SLV_165, SL_MAX_VERSION),
|
||||
};
|
||||
inline const static SaveLoadCompatTable compat_description = _town_received_sl_compat;
|
||||
|
||||
|
@@ -571,13 +571,13 @@ void FixupTrainLengths()
|
||||
}
|
||||
}
|
||||
|
||||
static uint8 _cargo_periods;
|
||||
static uint16 _cargo_source;
|
||||
static uint32 _cargo_source_xy;
|
||||
static uint16 _cargo_count;
|
||||
static uint16 _cargo_paid_for;
|
||||
static uint8_t _cargo_periods;
|
||||
static uint16_t _cargo_source;
|
||||
static uint32_t _cargo_source_xy;
|
||||
static uint16_t _cargo_count;
|
||||
static uint16_t _cargo_paid_for;
|
||||
static Money _cargo_feeder_share;
|
||||
static uint32 _cargo_loaded_at_xy;
|
||||
static uint32_t _cargo_loaded_at_xy;
|
||||
|
||||
class SlVehicleCommon : public DefaultSaveLoadHandler<SlVehicleCommon, Vehicle> {
|
||||
public:
|
||||
|
@@ -28,13 +28,13 @@ struct OldWaypoint {
|
||||
TileIndex xy;
|
||||
TownID town_index;
|
||||
Town *town;
|
||||
uint16 town_cn;
|
||||
uint16_t town_cn;
|
||||
StringID string_id;
|
||||
std::string name;
|
||||
uint8 delete_ctr;
|
||||
uint8_t delete_ctr;
|
||||
TimerGameCalendar::Date build_date;
|
||||
uint8 localidx;
|
||||
uint32 grfid;
|
||||
uint8_t localidx;
|
||||
uint32_t grfid;
|
||||
const StationSpec *spec;
|
||||
Owner owner;
|
||||
|
||||
|
Reference in New Issue
Block a user