[NSF] Fix various implicit type casting warnings (#14656)

These warnings caused compilation to fail on VS2019 Version 16.10.0 Preview 2.1, because warnings are being treated as errors.
This commit is contained in:
Hielke Morsink 2021-05-15 00:29:23 +02:00 committed by GitHub
parent 6ad924878b
commit 7171c8ac0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -865,11 +865,12 @@ namespace OpenRCT2
cs.ReadWriteVector(banners, [version, &cs](Banner& banner) { ReadWriteBanner(version, cs, banner); });
for (size_t i = 0; i < banners.size(); i++)
{
auto banner = GetOrCreateBanner(i);
auto bannerIndex = static_cast<BannerIndex>(i);
auto banner = GetOrCreateBanner(bannerIndex);
if (banner != nullptr)
{
*banner = std::move(banners[i]);
banner->id = static_cast<BannerIndex>(i);
banner->id = bannerIndex;
}
}
}

View File

@ -359,8 +359,8 @@ static std::pair<int32_t, int32_t> getPatrolAreaOffsetIndex(const CoordsXY& coor
auto x = tilePos.x / 4;
auto y = tilePos.y / 4;
auto bitIndex = (y * STAFF_PATROL_AREA_BLOCKS_PER_LINE) + x;
auto byteIndex = bitIndex / 32;
auto byteBitIndex = bitIndex % 32;
auto byteIndex = int32_t(bitIndex / 32);
auto byteBitIndex = int32_t(bitIndex % 32);
return { byteIndex, byteBitIndex };
}

View File

@ -1338,7 +1338,7 @@ private:
// index in the array ----^ ^--- bit position in the 8-bit value
// We do the opposite in this function to recover the x and y values.
int32_t peepOffset = staffId * RCT12_PATROL_AREA_SIZE;
int32_t peepOffset = static_cast<int32_t>(staffId) * RCT12_PATROL_AREA_SIZE;
for (int32_t i = 0; i < RCT12_PATROL_AREA_SIZE; i++)
{
staffmember->ClearPatrolArea();