CScriptSpawnPoint: Resolve sign conversion warnings

operator[] takes a size_t, not an int.
This commit is contained in:
Lioncash 2020-05-20 12:19:00 -04:00
parent 38213bae99
commit 677ed1ce9a
1 changed files with 14 additions and 14 deletions

View File

@ -15,18 +15,18 @@ CScriptSpawnPoint::CScriptSpawnPoint(TUniqueId uid, std::string_view name, const
bool defaultSpawn, bool active, bool morphed) bool defaultSpawn, bool active, bool morphed)
: CEntity(uid, info, active, name), x34_xf(xf), x64_itemCounts(itemCounts) { : CEntity(uid, info, active, name), x34_xf(xf), x64_itemCounts(itemCounts) {
#ifndef NDEBUG #ifndef NDEBUG
x64_itemCounts[int(CPlayerState::EItemType::MorphBall)] = 1; x64_itemCounts[size_t(CPlayerState::EItemType::MorphBall)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::MorphBallBombs)] = 1; x64_itemCounts[size_t(CPlayerState::EItemType::MorphBallBombs)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::PhazonSuit)] = 1; x64_itemCounts[size_t(CPlayerState::EItemType::PhazonSuit)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::ThermalVisor)] = 1; x64_itemCounts[size_t(CPlayerState::EItemType::ThermalVisor)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::XRayVisor)] = 1; x64_itemCounts[size_t(CPlayerState::EItemType::XRayVisor)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::GrappleBeam)] = 1; x64_itemCounts[size_t(CPlayerState::EItemType::GrappleBeam)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::BoostBall)] = 1; x64_itemCounts[size_t(CPlayerState::EItemType::BoostBall)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::ChargeBeam)] = 1; x64_itemCounts[size_t(CPlayerState::EItemType::ChargeBeam)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::PowerBombs)] = 8; x64_itemCounts[size_t(CPlayerState::EItemType::PowerBombs)] = 8;
x64_itemCounts[int(CPlayerState::EItemType::SpaceJumpBoots)] = 1; x64_itemCounts[size_t(CPlayerState::EItemType::SpaceJumpBoots)] = 1;
x64_itemCounts[int(CPlayerState::EItemType::Missiles)] = x64_itemCounts[size_t(CPlayerState::EItemType::Missiles)] =
std::max(x64_itemCounts[int(CPlayerState::EItemType::Missiles)], u32(5)); std::max(x64_itemCounts[size_t(CPlayerState::EItemType::Missiles)], u32(5));
#endif #endif
x10c_24_firstSpawn = defaultSpawn; x10c_24_firstSpawn = defaultSpawn;
x10c_25_morphed = morphed; x10c_25_morphed = morphed;
@ -77,8 +77,8 @@ void CScriptSpawnPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objI
} }
u32 CScriptSpawnPoint::GetPowerup(CPlayerState::EItemType item) const { u32 CScriptSpawnPoint::GetPowerup(CPlayerState::EItemType item) const {
const auto idx = static_cast<int>(item); const auto idx = static_cast<size_t>(item);
if (item >= CPlayerState::EItemType::Max || idx < 0) { if (item >= CPlayerState::EItemType::Max) {
return x64_itemCounts.front(); return x64_itemCounts.front();
} }
return x64_itemCounts[idx]; return x64_itemCounts[idx];