Use BannerIndex::UnderlyingType for iterations

This commit is contained in:
ζeh Matt 2021-11-30 18:40:59 +02:00
parent e201c3b7fd
commit e6187a0af4
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
2 changed files with 4 additions and 4 deletions

View File

@ -972,7 +972,7 @@ namespace OpenRCT2
cs.Write(static_cast<uint32_t>(numBanners)); cs.Write(static_cast<uint32_t>(numBanners));
[[maybe_unused]] size_t numWritten = 0; [[maybe_unused]] size_t numWritten = 0;
for (uint16_t i = 0; i < MAX_BANNERS; i++) for (BannerIndex::UnderlyingType i = 0; i < MAX_BANNERS; i++)
{ {
auto banner = GetBanner(BannerIndex::FromUnderlying(i)); auto banner = GetBanner(BannerIndex::FromUnderlying(i));
if (banner != nullptr) if (banner != nullptr)
@ -990,7 +990,7 @@ namespace OpenRCT2
{ {
std::vector<Banner> banners; std::vector<Banner> banners;
cs.ReadWriteVector(banners, [version, &cs](Banner& banner) { ReadWriteBanner(version, cs, banner); }); cs.ReadWriteVector(banners, [version, &cs](Banner& banner) { ReadWriteBanner(version, cs, banner); });
for (uint16_t i = 0; i < banners.size(); i++) for (BannerIndex::UnderlyingType i = 0; i < banners.size(); i++)
{ {
auto bannerIndex = BannerIndex::FromUnderlying(i); auto bannerIndex = BannerIndex::FromUnderlying(i);
auto banner = GetOrCreateBanner(bannerIndex); auto banner = GetOrCreateBanner(bannerIndex);

View File

@ -113,7 +113,7 @@ static ride_id_t banner_get_ride_index_at(const CoordsXYZ& bannerCoords)
static BannerIndex BannerGetNewIndex() static BannerIndex BannerGetNewIndex()
{ {
for (uint16_t bannerIndex = 0; bannerIndex < MAX_BANNERS; bannerIndex++) for (BannerIndex::UnderlyingType bannerIndex = 0; bannerIndex < MAX_BANNERS; bannerIndex++)
{ {
if (bannerIndex < _banners.size()) if (bannerIndex < _banners.size())
{ {
@ -238,7 +238,7 @@ ride_id_t banner_get_closest_ride_index(const CoordsXYZ& mapPos)
void banner_reset_broken_index() void banner_reset_broken_index()
{ {
for (uint16_t index = 0; index < _banners.size(); index++) for (BannerIndex::UnderlyingType index = 0; index < _banners.size(); index++)
{ {
const auto bannerId = BannerIndex::FromUnderlying(index); const auto bannerId = BannerIndex::FromUnderlying(index);
auto tileElement = banner_get_tile_element(bannerId); auto tileElement = banner_get_tile_element(bannerId);