From 53e94b7c3f1128ccaaa0ea11b4cabadbc54b095e Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 6 Oct 2016 01:12:06 +0900 Subject: [PATCH] Fix shadowing warnings --- apps/openmw/mwdialogue/scripttest.cpp | 4 ++-- apps/openmw/mwgui/birth.cpp | 2 +- apps/openmw/mwgui/mapwindow.cpp | 4 ++-- apps/openmw/mwgui/quickkeysmenu.cpp | 10 +++++----- apps/openmw/mwgui/race.cpp | 6 +++--- apps/openmw/mwmechanics/aisequence.cpp | 4 ++-- apps/openmw/mwmechanics/character.cpp | 22 ++++++++++------------ apps/openmw/mwmechanics/npcstats.cpp | 4 ++-- apps/openmw/mwmechanics/spellcasting.cpp | 14 +++++++------- apps/openmw/mwworld/containerstore.cpp | 8 ++++---- 10 files changed, 38 insertions(+), 40 deletions(-) diff --git a/apps/openmw/mwdialogue/scripttest.cpp b/apps/openmw/mwdialogue/scripttest.cpp index 3f4654610..54b4d8cd9 100644 --- a/apps/openmw/mwdialogue/scripttest.cpp +++ b/apps/openmw/mwdialogue/scripttest.cpp @@ -39,9 +39,9 @@ void test(const MWWorld::Ptr& actor, int &compiled, int &total, const Compiler:: { std::vector infos = filter.listAll(*it); - for (std::vector::iterator it = infos.begin(); it != infos.end(); ++it) + for (std::vector::iterator iter = infos.begin(); iter != infos.end(); ++iter) { - const ESM::DialInfo* info = *it; + const ESM::DialInfo* info = *iter; if (!info->mResultScript.empty()) { bool success = true; diff --git a/apps/openmw/mwgui/birth.cpp b/apps/openmw/mwgui/birth.cpp index de8614004..327d5e5cf 100644 --- a/apps/openmw/mwgui/birth.cpp +++ b/apps/openmw/mwgui/birth.cpp @@ -225,7 +225,7 @@ namespace MWGui mSpellItems.push_back(label); coord.top += lineHeight; - std::vector::const_iterator end = categories[category].spells.end(); + end = categories[category].spells.end(); for (std::vector::const_iterator it = categories[category].spells.begin(); it != end; ++it) { const std::string &spellId = *it; diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp index d51af87d9..4708d6753 100644 --- a/apps/openmw/mwgui/mapwindow.cpp +++ b/apps/openmw/mwgui/mapwindow.cpp @@ -559,8 +559,8 @@ namespace MWGui std::vector destNotes; CustomMarkerCollection::RangeType markers = mCustomMarkers.getMarkers(marker.dest); - for (CustomMarkerCollection::ContainerType::const_iterator it = markers.first; it != markers.second; ++it) - destNotes.push_back(it->second.mNote); + for (CustomMarkerCollection::ContainerType::const_iterator iter = markers.first; iter != markers.second; ++iter) + destNotes.push_back(iter->second.mNote); MarkerUserData data (mLocalMapRender); data.notes = destNotes; diff --git a/apps/openmw/mwgui/quickkeysmenu.cpp b/apps/openmw/mwgui/quickkeysmenu.cpp index f2ae8dd83..938574f83 100644 --- a/apps/openmw/mwgui/quickkeysmenu.cpp +++ b/apps/openmw/mwgui/quickkeysmenu.cpp @@ -476,16 +476,16 @@ namespace MWGui MWWorld::Ptr player = MWMechanics::getPlayer(); MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player); MWWorld::Ptr item; - for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it) + for (MWWorld::ContainerStoreIterator iter = store.begin(); iter != store.end(); ++iter) { - if (Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), id)) + if (Misc::StringUtils::ciEqual(iter->getCellRef().getRefId(), id)) { if (item.isEmpty() || // Prefer the stack with the lowest remaining uses - !item.getClass().hasItemHealth(*it) || - it->getClass().getItemHealth(*it) < item.getClass().getItemHealth(item)) + !item.getClass().hasItemHealth(*iter) || + iter->getClass().getItemHealth(*iter) < item.getClass().getItemHealth(item)) { - item = *it; + item = *iter; } } } diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index daa07d5c4..184ce0775 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -362,10 +362,10 @@ namespace MWGui std::sort(items.begin(), items.end(), sortRaces); int index = 0; - for (std::vector >::const_iterator it = items.begin(); it != items.end(); ++it) + for (std::vector >::const_iterator iter = items.begin(); iter != items.end(); ++iter) { - mRaceList->addItem(it->second, it->first); - if (Misc::StringUtils::ciEqual(it->first, mCurrentRaceId)) + mRaceList->addItem(iter->second, iter->first); + if (Misc::StringUtils::ciEqual(iter->first, mCurrentRaceId)) mRaceList->setIndexSelected(index); ++index; } diff --git a/apps/openmw/mwmechanics/aisequence.cpp b/apps/openmw/mwmechanics/aisequence.cpp index b03586c3b..a134fd44a 100644 --- a/apps/openmw/mwmechanics/aisequence.cpp +++ b/apps/openmw/mwmechanics/aisequence.cpp @@ -91,8 +91,8 @@ std::list::const_iterator AiSequence::erase(std::list::c { if (package == it) { - AiPackage* package = *it; - delete package; + AiPackage* packagePtr = *it; + delete packagePtr; return mPackages.erase(it); } } diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 6aaba9635..5ca9b09aa 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -478,28 +478,28 @@ void CharacterController::refreshIdleAnims(const WeaponInfo* weap, CharacterStat mIdleState = idle; size_t numLoops = ~0ul; - std::string idle; + std::string idleGroup; MWRender::Animation::AnimPriority idlePriority (Priority_Default); // Only play "idleswim" or "idlesneak" if they exist. Otherwise, fallback to // "idle"+weapon or "idle". if(mIdleState == CharState_IdleSwim && mAnimation->hasAnimation("idleswim")) { - idle = "idleswim"; + idleGroup = "idleswim"; idlePriority = Priority_SwimIdle; } else if(mIdleState == CharState_IdleSneak && mAnimation->hasAnimation("idlesneak")) { - idle = "idlesneak"; + idleGroup = "idlesneak"; idlePriority[MWRender::Animation::BoneGroup_LowerBody] = Priority_SneakIdleLowerBody; } else if(mIdleState != CharState_None) { - idle = "idle"; + idleGroup = "idle"; if(weap != sWeaponTypeListEnd) { - idle += weap->shortgroup; - if(!mAnimation->hasAnimation(idle)) - idle = "idle"; + idleGroup += weap->shortgroup; + if(!mAnimation->hasAnimation(idleGroup)) + idleGroup = "idle"; // play until the Loop Stop key 2 to 5 times, then play until the Stop key // this replicates original engine behavior for the "Idle1h" 1st-person animation @@ -508,7 +508,7 @@ void CharacterController::refreshIdleAnims(const WeaponInfo* weap, CharacterStat } mAnimation->disable(mCurrentIdle); - mCurrentIdle = idle; + mCurrentIdle = idleGroup; if(!mCurrentIdle.empty()) mAnimation->play(mCurrentIdle, idlePriority, MWRender::Animation::BlendMask_All, false, 1.0f, "start", "stop", 0.0f, numLoops, true); @@ -571,8 +571,8 @@ MWWorld::ContainerStoreIterator getActiveWeapon(CreatureStats &stats, MWWorld::I else if(type == typeid(ESM::Weapon).name()) { MWWorld::LiveCellRef *ref = weapon->get(); - ESM::Weapon::Type type = (ESM::Weapon::Type)ref->mBase->mData.mType; - switch(type) + ESM::Weapon::Type weaponType = (ESM::Weapon::Type)ref->mBase->mData.mType; + switch(weaponType) { case ESM::Weapon::ShortBladeOneHand: case ESM::Weapon::LongBladeOneHand: @@ -1740,14 +1740,12 @@ void CharacterController::update(float duration) cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 0); // decrease fatigue - const MWWorld::Store &gmst = world->getStore().get(); const float fatigueJumpBase = gmst.find("fFatigueJumpBase")->getFloat(); const float fatigueJumpMult = gmst.find("fFatigueJumpMult")->getFloat(); float normalizedEncumbrance = mPtr.getClass().getNormalizedEncumbrance(mPtr); if (normalizedEncumbrance > 1) normalizedEncumbrance = 1; const float fatigueDecrease = fatigueJumpBase + (1 - normalizedEncumbrance) * fatigueJumpMult; - DynamicStat fatigue = cls.getCreatureStats(mPtr).getFatigue(); fatigue.setCurrent(fatigue.getCurrent() - fatigueDecrease); cls.getCreatureStats(mPtr).setFatigue(fatigue); } diff --git a/apps/openmw/mwmechanics/npcstats.cpp b/apps/openmw/mwmechanics/npcstats.cpp index 8bea109d0..0b016e69d 100644 --- a/apps/openmw/mwmechanics/npcstats.cpp +++ b/apps/openmw/mwmechanics/npcstats.cpp @@ -83,8 +83,8 @@ void MWMechanics::NpcStats::raiseRank(const std::string &faction) if (it != mFactionRank.end()) { // Does the next rank exist? - const ESM::Faction* faction = MWBase::Environment::get().getWorld()->getStore().get().find(lower); - if (it->second+1 < 10 && !faction->mRanks[it->second+1].empty()) + const ESM::Faction* factionPtr = MWBase::Environment::get().getWorld()->getStore().get().find(lower); + if (it->second+1 < 10 && !factionPtr->mRanks[it->second+1].empty()) it->second += 1; } } diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index ad05ca41f..1fc800a7c 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -495,13 +495,13 @@ namespace MWMechanics { if (effectIt->mEffectID == ESM::MagicEffect::AbsorbAttribute+i) { - std::vector effects; + std::vector absorbEffects; ActiveSpells::ActiveEffect effect_ = effect; effect_.mMagnitude *= -1; - effects.push_back(effect_); + absorbEffects.push_back(effect_); // Also make sure to set casterActorId = target, so that the effect on the caster gets purged when the target dies caster.getClass().getCreatureStats(caster).getActiveSpells().addSpell("", true, - effects, mSourceName, target.getClass().getCreatureStats(target).getActorId()); + absorbEffects, mSourceName, target.getClass().getCreatureStats(target).getActorId()); } } } @@ -512,11 +512,11 @@ namespace MWMechanics if (isSummoningEffect(effectIt->mEffectID) && !target.isEmpty() && target.getClass().isActor()) { CreatureStats& targetStats = target.getClass().getCreatureStats(target); - std::map::iterator found = targetStats.getSummonedCreatureMap().find(std::make_pair(effectIt->mEffectID, mId)); - if (found != targetStats.getSummonedCreatureMap().end()) + std::map::iterator findCreature = targetStats.getSummonedCreatureMap().find(std::make_pair(effectIt->mEffectID, mId)); + if (findCreature != targetStats.getSummonedCreatureMap().end()) { - MWBase::Environment::get().getMechanicsManager()->cleanupSummonedCreature(target, found->second); - targetStats.getSummonedCreatureMap().erase(found); + MWBase::Environment::get().getMechanicsManager()->cleanupSummonedCreature(target, findCreature->second); + targetStats.getSummonedCreatureMap().erase(findCreature); } } diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index 7ac0d9d4e..7eb7c31c7 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -423,12 +423,12 @@ void MWWorld::ContainerStore::addInitialItem (const std::string& id, const std:: if (ref.getPtr().getTypeName()==typeid (ESM::ItemLevList).name()) { - const ESM::ItemLevList* levItem = ref.getPtr().get()->mBase; + const ESM::ItemLevList* levItemList = ref.getPtr().get()->mBase; - if (topLevel && std::abs(count) > 1 && levItem->mFlags & ESM::ItemLevList::Each) + if (topLevel && std::abs(count) > 1 && levItemList->mFlags & ESM::ItemLevList::Each) { for (int i=0; i 0 ? 1 : -1, true, levItem->mId); + addInitialItem(id, owner, count > 0 ? 1 : -1, true, levItemList->mId); return; } else @@ -436,7 +436,7 @@ void MWWorld::ContainerStore::addInitialItem (const std::string& id, const std:: std::string id = MWMechanics::getLevelledItem(ref.getPtr().get()->mBase, false); if (id.empty()) return; - addInitialItem(id, owner, count, false, levItem->mId); + addInitialItem(id, owner, count, false, levItemList->mId); } } else