From d0d6210ccdd8ec3e7032f2fce3e71dbc8bc7d2b4 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 16 Mar 2020 19:07:41 -0400 Subject: [PATCH] CGrappleArm: Resolve sign mismatch warnings in loops --- Runtime/Weapon/CGrappleArm.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Runtime/Weapon/CGrappleArm.cpp b/Runtime/Weapon/CGrappleArm.cpp index 66f994d91..a899c7384 100644 --- a/Runtime/Weapon/CGrappleArm.cpp +++ b/Runtime/Weapon/CGrappleArm.cpp @@ -1,5 +1,7 @@ #include "Runtime/Weapon/CGrappleArm.hpp" +#include + #include "Runtime/CDependencyGroup.hpp" #include "Runtime/CSimplePool.hpp" #include "Runtime/GameGlobalObjects.hpp" @@ -54,11 +56,6 @@ CGrappleArm::CGrappleArm(const zeus::CVector3f& scale) LoadAnimations(); } -static const char* skDependencyNames[] = { - "PowerSuit_DGRP", "GravitySuit_DGRP", "VariaSuit_DGRP", "PhazonSuit_DGRP", - "FusionSuit_DGRP", "FusionSuitG_DGRP", "FusionSuitV_DGRP", "FusionSuitP_DGRP", -}; - void CGrappleArm::FillTokenVector(const std::vector& tags, std::vector& objects) { objects.reserve(tags.size()); for (const SObjectTag& tag : tags) @@ -66,8 +63,13 @@ void CGrappleArm::FillTokenVector(const std::vector& tags, std::vect } void CGrappleArm::BuildSuitDependencyList() { + static constexpr std::array skDependencyNames{ + "PowerSuit_DGRP"sv, "GravitySuit_DGRP"sv, "VariaSuit_DGRP"sv, "PhazonSuit_DGRP"sv, + "FusionSuit_DGRP"sv, "FusionSuitG_DGRP"sv, "FusionSuitV_DGRP"sv, "FusionSuitP_DGRP"sv, + }; + x184_grappleArm.Lock(); - for (const char* name : skDependencyNames) { + for (const auto& name : skDependencyNames) { TLockedToken dgrp = g_SimplePool->GetObj(name); std::vector& depsOut = x19c_suitDeps.emplace_back(); FillTokenVector(dgrp->GetObjectTagVector(), depsOut); @@ -254,7 +256,7 @@ void CGrappleArm::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, void CGrappleArm::DoUserAnimEvents(CStateManager& mgr) { zeus::CVector3f armToCam = mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTranslation() - x220_xf.origin; const CAnimData& animData = *x0_grappleArmModel->GetAnimationData(); - for (int i = 0; i < animData.GetPassedSoundPOICount(); ++i) { + for (size_t i = 0; i < animData.GetPassedSoundPOICount(); ++i) { const CSoundPOINode& node = CAnimData::g_SoundPOINodes[i]; if (node.GetPoiType() != EPOIType::Sound || (node.GetCharacterIndex() != -1 && animData.x204_charIdx != node.GetCharacterIndex())) @@ -263,7 +265,7 @@ void CGrappleArm::DoUserAnimEvents(CStateManager& mgr) { node.GetFlags(), node.GetFalloff(), node.GetMaxDist(), 0.16f, 1.f, armToCam, x220_xf.origin, mgr.GetPlayer().GetAreaIdAlways(), mgr); } - for (int i = 0; i < animData.GetPassedIntPOICount(); ++i) { + for (size_t i = 0; i < animData.GetPassedIntPOICount(); ++i) { const CInt32POINode& node = CAnimData::g_Int32POINodes[i]; switch (node.GetPoiType()) { case EPOIType::UserEvent: