Fix msvc warnings

openmw\apps\opencs\model\world\idcollection.cpp(65): warning C4457: declaration of 'index' hides function parameter

openmw\apps\openmw\mwscript\miscextensions.cpp(627): warning C4456: declaration of 'effect' hides previous local declaration
This commit is contained in:
elsid 2025-08-03 14:11:38 +02:00
parent b9a28dab3e
commit 555a10f50c
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625
2 changed files with 10 additions and 11 deletions

View File

@ -59,14 +59,13 @@ namespace CSMWorld
const Record<ESM::LandTexture>* IdCollection<ESM::LandTexture>::searchRecord(std::uint16_t index, int plugin) const
{
auto found = mIndices.find({ plugin, index });
if (found != mIndices.end())
{
int index = searchId(found->second);
if (index != -1)
return &getRecord(index);
}
return nullptr;
const auto it = mIndices.find({ plugin, index });
if (it == mIndices.end())
return nullptr;
const int recordIndex = searchId(it->second);
if (recordIndex == -1)
return nullptr;
return &getRecord(recordIndex);
}
const std::string* IdCollection<ESM::LandTexture>::getLandTexture(std::uint16_t index, int plugin) const

View File

@ -604,7 +604,7 @@ namespace MWScript
{
MWWorld::Ptr ptr = R()(runtime);
std::string_view effect = runtime.getStringLiteral(runtime[0].mInteger);
const std::string_view effectName = runtime.getStringLiteral(runtime[0].mInteger);
runtime.pop();
if (!ptr.getClass().isActor())
@ -615,11 +615,11 @@ namespace MWScript
long key;
if (const auto k = ::Misc::StringUtils::toNumeric<long>(effect);
if (const auto k = ::Misc::StringUtils::toNumeric<long>(effectName);
k.has_value() && *k >= 0 && *k <= 32767)
key = *k;
else
key = ESM::MagicEffect::effectGmstIdToIndex(effect);
key = ESM::MagicEffect::effectGmstIdToIndex(effectName);
const MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
for (const auto& spell : stats.getActiveSpells())