Codechange: make TimerGameCalendar Date and Year types strongly typed (#10761)
This commit is contained in:
@@ -169,7 +169,7 @@ struct MAP2ChunkHandler : ChunkHandler {
|
||||
std::array<uint16_t, MAP_SL_BUF_SIZE> buf;
|
||||
TileIndex size = Map::Size();
|
||||
|
||||
SlSetLength(size * sizeof(uint16_t));
|
||||
SlSetLength(static_cast<uint32_t>(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);
|
||||
@@ -344,7 +344,7 @@ struct MAP8ChunkHandler : ChunkHandler {
|
||||
std::array<uint16_t, MAP_SL_BUF_SIZE> buf;
|
||||
TileIndex size = Map::Size();
|
||||
|
||||
SlSetLength(size * sizeof(uint16_t));
|
||||
SlSetLength(static_cast<uint32_t>(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);
|
||||
|
@@ -93,9 +93,6 @@ struct OldChunks {
|
||||
OldChunkProc *proc; ///< Pointer to function that is called with OC_CHUNK
|
||||
};
|
||||
|
||||
/* If it fails, check lines above.. */
|
||||
static_assert(sizeof(TileIndex) == 4);
|
||||
|
||||
extern uint _bump_assert_value;
|
||||
byte ReadByte(LoadgameState *ls);
|
||||
bool LoadChunk(LoadgameState *ls, void *base, const OldChunks *chunks);
|
||||
|
@@ -57,8 +57,8 @@ static void FixTTDMapArray()
|
||||
/* _old_map3 is moved to _m::m3 and _m::m4 */
|
||||
for (TileIndex t = 0; t < OLD_MAP_SIZE; t++) {
|
||||
Tile tile(t);
|
||||
tile.m3() = _old_map3[t * 2];
|
||||
tile.m4() = _old_map3[t * 2 + 1];
|
||||
tile.m3() = _old_map3[static_cast<uint32_t>(t) * 2];
|
||||
tile.m4() = _old_map3[static_cast<uint32_t>(t) * 2 + 1];
|
||||
}
|
||||
|
||||
for (TileIndex t = 0; t < OLD_MAP_SIZE; t++) {
|
||||
@@ -416,7 +416,7 @@ static bool FixTTOEngines()
|
||||
if (TimerGameCalendar::date >= e->intro_date && HasBit(e->info.climates, 0)) {
|
||||
e->flags |= ENGINE_AVAILABLE;
|
||||
e->company_avail = MAX_UVALUE(CompanyMask);
|
||||
e->age = TimerGameCalendar::date > e->intro_date ? (TimerGameCalendar::date - e->intro_date) / 30 : 0;
|
||||
e->age = TimerGameCalendar::date > e->intro_date ? static_cast<int32_t>(TimerGameCalendar::date - e->intro_date) / 30 : 0;
|
||||
}
|
||||
} else {
|
||||
/* Using data from TTO savegame */
|
||||
|
Reference in New Issue
Block a user