mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 01:15:33 +00:00
Use descriptive names for range elements
iter does not describe the nature of the object. Range-based for loop provides elements of the iterator range, not iterators.
This commit is contained in:
parent
cec7f1e7bc
commit
1b117af5e1
2 changed files with 16 additions and 16 deletions
|
@ -238,15 +238,15 @@ namespace MWScript
|
|||
|
||||
void GlobalScripts::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
|
||||
{
|
||||
for (const auto& iter : mScripts)
|
||||
for (const auto& [id, desc] : mScripts)
|
||||
{
|
||||
ESM::GlobalScript script = std::visit (ScriptCreatingVisitor {}, iter.second->mTarget);
|
||||
ESM::GlobalScript script = std::visit(ScriptCreatingVisitor {}, desc->mTarget);
|
||||
|
||||
script.mId = iter.first;
|
||||
script.mId = id;
|
||||
|
||||
iter.second->mLocals.write (script.mLocals, iter.first);
|
||||
desc->mLocals.write(script.mLocals, id);
|
||||
|
||||
script.mRunning = iter.second->mRunning ? 1 : 0;
|
||||
script.mRunning = desc->mRunning ? 1 : 0;
|
||||
|
||||
writer.startRecord (ESM::REC_GSCR);
|
||||
script.save (writer);
|
||||
|
|
|
@ -44,10 +44,10 @@ namespace
|
|||
{
|
||||
float sum = 0;
|
||||
|
||||
for (const auto& iter : cellRefList.mList)
|
||||
for (const MWWorld::LiveCellRef<T>& liveCellRef : cellRefList.mList)
|
||||
{
|
||||
if (iter.mData.getCount()>0)
|
||||
sum += iter.mData.getCount()*iter.mBase->mData.mWeight;
|
||||
if (const int count = liveCellRef.mData.getCount(); count > 0)
|
||||
sum += count * liveCellRef.mBase->mData.mWeight;
|
||||
}
|
||||
|
||||
return sum;
|
||||
|
@ -60,11 +60,11 @@ namespace
|
|||
store->resolve();
|
||||
std::string id2 = Misc::StringUtils::lowerCase (id);
|
||||
|
||||
for (auto& iter : list.mList)
|
||||
for (MWWorld::LiveCellRef<T>& liveCellRef : list.mList)
|
||||
{
|
||||
if (Misc::StringUtils::ciEqual(iter.mBase->mId, id2) && iter.mData.getCount())
|
||||
if (Misc::StringUtils::ciEqual(liveCellRef.mBase->mId, id2) && liveCellRef.mData.getCount())
|
||||
{
|
||||
MWWorld::Ptr ptr (&iter, nullptr);
|
||||
MWWorld::Ptr ptr(&liveCellRef, nullptr);
|
||||
ptr.setContainerStore (store);
|
||||
return ptr;
|
||||
}
|
||||
|
@ -124,15 +124,15 @@ template<typename T>
|
|||
void MWWorld::ContainerStore::storeStates (const CellRefList<T>& collection,
|
||||
ESM::InventoryState& inventory, int& index, bool equipable) const
|
||||
{
|
||||
for (const auto& iter : collection.mList)
|
||||
for (const LiveCellRef<T>& liveCellRef : collection.mList)
|
||||
{
|
||||
if (iter.mData.getCount() == 0)
|
||||
if (liveCellRef.mData.getCount() == 0)
|
||||
continue;
|
||||
ESM::ObjectState state;
|
||||
storeState (iter, state);
|
||||
storeState(liveCellRef, state);
|
||||
if (equipable)
|
||||
storeEquipmentState(iter, index, inventory);
|
||||
inventory.mItems.push_back (state);
|
||||
storeEquipmentState(liveCellRef, index, inventory);
|
||||
inventory.mItems.push_back(std::move(state));
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue