Porting more ContainerStoreIterator usage to const version #3

This commit is contained in:
Rafael Moura 2017-02-28 14:31:51 +00:00
parent 18a4b64f1a
commit 7fa2703715
6 changed files with 13 additions and 13 deletions

View file

@ -344,7 +344,7 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
case SelectWrapper::Function_PcClothingModifier: case SelectWrapper::Function_PcClothingModifier:
{ {
MWWorld::InventoryStore& store = player.getClass().getInventoryStore (player); const MWWorld::InventoryStore& store = player.getClass().getInventoryStore (player);
int value = 0; int value = 0;

View file

@ -1194,7 +1194,7 @@ bool CharacterController::updateWeaponState()
if(isWeapon) if(isWeapon)
weapSpeed = weapon->get<ESM::Weapon>()->mBase->mData.mSpeed; weapSpeed = weapon->get<ESM::Weapon>()->mBase->mData.mSpeed;
MWWorld::ContainerStoreIterator ammo = inv.getSlot(MWWorld::InventoryStore::Slot_Ammunition); MWWorld::ConstContainerStoreIterator ammo = inv.getSlot(MWWorld::InventoryStore::Slot_Ammunition);
if (mWeaponType == WeapType_Crossbow) if (mWeaponType == WeapType_Crossbow)
ammunition = (ammo != inv.end() && ammo->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::Bolt); ammunition = (ammo != inv.end() && ammo->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::Bolt);
else if (mWeaponType == WeapType_BowAndArrow) else if (mWeaponType == WeapType_BowAndArrow)

View file

@ -1310,8 +1310,8 @@ namespace MWMechanics
float bootWeight = 0; float bootWeight = 0;
if (ptr.getClass().isNpc()) if (ptr.getClass().isNpc())
{ {
MWWorld::InventoryStore& inv = ptr.getClass().getInventoryStore(ptr); const MWWorld::InventoryStore& inv = ptr.getClass().getInventoryStore(ptr);
MWWorld::ContainerStoreIterator it = inv.getSlot(MWWorld::InventoryStore::Slot_Boots); MWWorld::ConstContainerStoreIterator it = inv.getSlot(MWWorld::InventoryStore::Slot_Boots);
if (it != inv.end()) if (it != inv.end())
bootWeight = it->getClass().getWeight(*it); bootWeight = it->getClass().getWeight(*it);
} }

View file

@ -259,7 +259,7 @@ namespace MWRender
mCurrentAnimGroup = groupname; mCurrentAnimGroup = groupname;
mAnimation->play(mCurrentAnimGroup, 1, Animation::BlendMask_All, false, 1.0f, "start", "stop", 0.0f, 0); mAnimation->play(mCurrentAnimGroup, 1, Animation::BlendMask_All, false, 1.0f, "start", "stop", 0.0f, 0);
MWWorld::ContainerStoreIterator torch = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft); MWWorld::ConstContainerStoreIterator torch = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
if(torch != inv.end() && torch->getTypeName() == typeid(ESM::Light).name() && showCarriedLeft) if(torch != inv.end() && torch->getTypeName() == typeid(ESM::Light).name() && showCarriedLeft)
{ {
if(!mAnimation->getInfo("torch")) if(!mAnimation->getInfo("torch"))

View file

@ -97,15 +97,15 @@ void CreatureWeaponAnimation::updatePart(PartHolderPtr& scene, int slot)
if (!mObjectRoot) if (!mObjectRoot)
return; return;
MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr); const MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr);
MWWorld::ContainerStoreIterator it = inv.getSlot(slot); MWWorld::ConstContainerStoreIterator it = inv.getSlot(slot);
if (it == inv.end()) if (it == inv.end())
{ {
scene.reset(); scene.reset();
return; return;
} }
MWWorld::Ptr item = *it; MWWorld::ConstPtr item = *it;
std::string bonename; std::string bonename;
if (slot == MWWorld::InventoryStore::Slot_CarriedRight) if (slot == MWWorld::InventoryStore::Slot_CarriedRight)
@ -135,7 +135,7 @@ void CreatureWeaponAnimation::updatePart(PartHolderPtr& scene, int slot)
item.getTypeName() == typeid(ESM::Weapon).name() && item.getTypeName() == typeid(ESM::Weapon).name() &&
item.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanCrossbow) item.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanCrossbow)
{ {
MWWorld::ContainerStoreIterator ammo = inv.getSlot(MWWorld::InventoryStore::Slot_Ammunition); MWWorld::ConstContainerStoreIterator ammo = inv.getSlot(MWWorld::InventoryStore::Slot_Ammunition);
if (ammo != inv.end() && ammo->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::Bolt) if (ammo != inv.end() && ammo->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::Bolt)
attachArrow(); attachArrow();
else else

View file

@ -574,10 +574,10 @@ void NpcAnimation::updateParts()
bool wasArrowAttached = (mAmmunition.get() != NULL); bool wasArrowAttached = (mAmmunition.get() != NULL);
mAmmunition.reset(); mAmmunition.reset();
MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr); const MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr);
for(size_t i = 0;i < slotlistsize && mViewMode != VM_HeadOnly;i++) for(size_t i = 0;i < slotlistsize && mViewMode != VM_HeadOnly;i++)
{ {
MWWorld::ContainerStoreIterator store = inv.getSlot(slotlist[i].mSlot); MWWorld::ConstContainerStoreIterator store = inv.getSlot(slotlist[i].mSlot);
removePartGroup(slotlist[i].mSlot); removePartGroup(slotlist[i].mSlot);
@ -634,8 +634,8 @@ void NpcAnimation::updateParts()
if(mPartPriorities[ESM::PRT_Shield] < 1) if(mPartPriorities[ESM::PRT_Shield] < 1)
{ {
MWWorld::ContainerStoreIterator store = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft); MWWorld::ConstContainerStoreIterator store = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
MWWorld::Ptr part; MWWorld::ConstPtr part;
if(store != inv.end() && (part=*store).getTypeName() == typeid(ESM::Light).name()) if(store != inv.end() && (part=*store).getTypeName() == typeid(ESM::Light).name())
{ {
const ESM::Light *light = part.get<ESM::Light>()->mBase; const ESM::Light *light = part.get<ESM::Light>()->mBase;