[Client] Make foreach style consistent with other

pull/249/merge
Koncord 8 years ago
parent 2427a4f877
commit 0ed0d2417b

@ -174,7 +174,7 @@ void ActorList::sendActorsInCell(MWWorld::CellStore* cellStore)
cell = *cellStore->getCell();
action = BaseActorList::SET;
for(auto &ref : cellStore->getNpcs()->mList)
for (auto &ref : cellStore->getNpcs()->mList)
{
MWWorld::Ptr ptr(&ref, 0);
@ -189,7 +189,7 @@ void ActorList::sendActorsInCell(MWWorld::CellStore* cellStore)
addActor(actor);
}
for(auto &ref : cellStore->getCreatures()->mList)
for (auto &ref : cellStore->getCreatures()->mList)
{
MWWorld::Ptr ptr(&ref, 0);

@ -96,7 +96,7 @@ void Cell::updateDedicated(float dt)
{
if (dedicatedActors.empty()) return;
for(auto &actor : dedicatedActors)
for (auto &actor : dedicatedActors)
actor.second->update(dt);
// Are we the authority over this cell? If so, uninitialize DedicatedActors
@ -109,7 +109,7 @@ void Cell::readPositions(ActorList& actorList)
{
initializeDedicatedActors(actorList);
for(const auto &baseActor : actorList.baseActors)
for (const auto &baseActor : actorList.baseActors)
{
std::string mapIndex = Main::get().getCellController()->generateMapIndex(baseActor);
@ -136,7 +136,7 @@ void Cell::readPositions(ActorList& actorList)
void Cell::readAnimFlags(ActorList& actorList)
{
for(const auto &baseActor : actorList.baseActors)
for (const auto &baseActor : actorList.baseActors)
{
std::string mapIndex = Main::get().getCellController()->generateMapIndex(baseActor);
@ -152,7 +152,7 @@ void Cell::readAnimFlags(ActorList& actorList)
void Cell::readAnimPlay(ActorList& actorList)
{
for(const auto &baseActor : actorList.baseActors)
for (const auto &baseActor : actorList.baseActors)
{
std::string mapIndex = Main::get().getCellController()->generateMapIndex(baseActor);
@ -171,7 +171,7 @@ void Cell::readStatsDynamic(ActorList& actorList)
{
initializeDedicatedActors(actorList);
for(const auto &baseActor : actorList.baseActors)
for (const auto &baseActor : actorList.baseActors)
{
std::string mapIndex = Main::get().getCellController()->generateMapIndex(baseActor);
@ -207,7 +207,7 @@ void Cell::readEquipment(ActorList& actorList)
{
initializeDedicatedActors(actorList);
for(const auto &baseActor : actorList.baseActors)
for (const auto &baseActor : actorList.baseActors)
{
std::string mapIndex = Main::get().getCellController()->generateMapIndex(baseActor);
@ -225,7 +225,7 @@ void Cell::readEquipment(ActorList& actorList)
void Cell::readSpeech(ActorList& actorList)
{
for(const auto &baseActor : actorList.baseActors)
for (const auto &baseActor : actorList.baseActors)
{
std::string mapIndex = Main::get().getCellController()->generateMapIndex(baseActor);
@ -240,7 +240,7 @@ void Cell::readSpeech(ActorList& actorList)
void Cell::readAttack(ActorList& actorList)
{
for(const auto &baseActor : actorList.baseActors)
for (const auto &baseActor : actorList.baseActors)
{
std::string mapIndex = Main::get().getCellController()->generateMapIndex(baseActor);
@ -273,7 +273,7 @@ void Cell::readCellChange(ActorList& actorList)
CellController *cellController = Main::get().getCellController();
for(const auto &baseActor : actorList.baseActors)
for (const auto &baseActor : actorList.baseActors)
{
std::string mapIndex = Main::get().getCellController()->generateMapIndex(baseActor);
@ -378,7 +378,7 @@ void Cell::initializeDedicatedActor(const MWWorld::Ptr& ptr)
void Cell::initializeDedicatedActors(ActorList& actorList)
{
for(const auto &baseActor : actorList.baseActors)
for (const auto &baseActor : actorList.baseActors)
{
std::string mapIndex = Main::get().getCellController()->generateMapIndex(baseActor);
@ -396,7 +396,7 @@ void Cell::initializeDedicatedActors(ActorList& actorList)
void Cell::uninitializeLocalActors()
{
for(const auto &actor : localActors)
for (const auto &actor : localActors)
{
Main::get().getCellController()->removeLocalActorRecord(actor.first);
delete actor.second;
@ -407,7 +407,7 @@ void Cell::uninitializeLocalActors()
void Cell::uninitializeDedicatedActors()
{
for(const auto &actor : dedicatedActors)
for (const auto &actor : dedicatedActors)
{
Main::get().getCellController()->removeDedicatedActorRecord(actor.first);
delete actor.second;

@ -48,7 +48,7 @@ void CellController::updateLocal(bool forceUpdate)
//
// Note: This cannot be combined with the above loop because initializing LocalActors in a Cell before they are
// deleted from their previous one can make their records stay deleted
for(auto &cell : cellsInitialized)
for (auto &cell : cellsInitialized)
{
mwmp::Cell *mpCell = cell.second;
if (mpCell->shouldInitializeActors == true)
@ -61,7 +61,7 @@ void CellController::updateLocal(bool forceUpdate)
void CellController::updateDedicated(float dt)
{
for(const auto &cell : cellsInitialized)
for (const auto &cell : cellsInitialized)
cell.second->updateDedicated(dt);
}
@ -342,7 +342,7 @@ void CellController::openContainer(const MWWorld::Ptr &container, bool loot)
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Container \"%s\" (%d) is opened. Loot: %s",
cellRef.getRefId().c_str(), cellRef.getRefNum().mIndex, loot ? "true" : "false");
for(const auto &ptr : container.getClass().getContainerStore(container))
for (const auto &ptr : container.getClass().getContainerStore(container))
{
int count = ptr.getRefData().getCount();
const std::string &name = ptr.getCellRef().getRefId();
@ -366,7 +366,7 @@ void CellController::closeContainer(const MWWorld::Ptr &container)
container.getCellRef().getRefNum().mIndex);
MWWorld::ContainerStore &cont = container.getClass().getContainerStore(container);
for(const auto &ptr : cont)
for (const auto &ptr : cont)
{
LOG_APPEND(Log::LOG_VERBOSE, " - Item. Refid: \"%s\" Count: %d", ptr.getCellRef().getRefId().c_str(),
ptr.getRefData().getCount());

@ -98,7 +98,7 @@ void mwmp::GUIController::showDialogList(const mwmp::BasePlayer::GUIMessageBox &
std::string buf;
for(const auto &data : guiMessageBox.data)
for (const auto &data : guiMessageBox.data)
{
if (data == '\n')
{
@ -373,7 +373,7 @@ void mwmp::GUIController::setGlobalMapMarkerTooltip(MWGui::MapWindow *mapWindow,
void mwmp::GUIController::updateGlobalMapMarkerTooltips(MWGui::MapWindow *mapWindow)
{
for(const auto &widget : mapWindow->mGlobalMapMarkers)
for (const auto &widget : mapWindow->mGlobalMapMarkers)
{
const int x = widget.first.first;
const int y = widget.first.second;

@ -463,7 +463,7 @@ void LocalPlayer::updateInventory(bool forceUpdate)
if (!invChanged)
{
for(const auto &itemOld : inventoryChanges.items)
for (const auto &itemOld : inventoryChanges.items)
{
auto result = ptrInventory.begin();
for (; result != ptrInventory.end(); ++result)
@ -484,7 +484,7 @@ void LocalPlayer::updateInventory(bool forceUpdate)
if (!invChanged)
{
for(const auto &iter : ptrInventory)
for (const auto &iter : ptrInventory)
{
if(setItem(item, iter))
continue;
@ -624,7 +624,7 @@ void LocalPlayer::addItems()
MWWorld::Ptr ptrPlayer = getPlayerPtr();
MWWorld::ContainerStore &ptrStore = ptrPlayer.getClass().getContainerStore(ptrPlayer);
for(const auto &item : inventoryChanges.items)
for (const auto &item : inventoryChanges.items)
{
MWWorld::Ptr itemPtr = *ptrStore.add(item.refId, item.count, ptrPlayer);
if (item.charge != -1)
@ -637,14 +637,14 @@ void LocalPlayer::addSpells()
MWWorld::Ptr ptrPlayer = getPlayerPtr();
MWMechanics::Spells &ptrSpells = ptrPlayer.getClass().getCreatureStats(ptrPlayer).getSpells();
for(const auto &spell : spellbookChanges.spells)
for (const auto &spell : spellbookChanges.spells)
ptrSpells.add(spell.mId);
}
void LocalPlayer::addJournalItems()
{
for(const auto &journalItem : journalChanges.journalItems)
for (const auto &journalItem : journalChanges.journalItems)
{
if (journalItem.type == JournalItem::ENTRY)
{
@ -663,7 +663,7 @@ void LocalPlayer::addJournalItems()
void LocalPlayer::addTopics()
{
auto &env = MWBase::Environment::get();
for(const auto &topic : topicChanges.topics)
for (const auto &topic : topicChanges.topics)
{
std::string topicId = topic.topicId;
@ -683,7 +683,7 @@ void LocalPlayer::removeItems()
MWWorld::Ptr ptrPlayer = getPlayerPtr();
MWWorld::ContainerStore &ptrStore = ptrPlayer.getClass().getContainerStore(ptrPlayer);
for(const auto &item : inventoryChanges.items)
for (const auto &item : inventoryChanges.items)
ptrStore.remove(item.refId, item.count, ptrPlayer);
}
@ -693,7 +693,7 @@ void LocalPlayer::removeSpells()
MWMechanics::Spells &ptrSpells = ptrPlayer.getClass().getCreatureStats(ptrPlayer).getSpells();
MWBase::WindowManager *wm = MWBase::Environment::get().getWindowManager();
for(const auto &spell : spellbookChanges.spells)
for (const auto &spell : spellbookChanges.spells)
{
ptrSpells.remove(spell.mId);
if (spell.mId == wm->getSelectedSpell())
@ -943,7 +943,7 @@ void LocalPlayer::setFactions()
MWWorld::Ptr player = getPlayerPtr();
MWMechanics::NpcStats &ptrNpcStats = player.getClass().getNpcStats(player);
for(const auto &faction : factionChanges.factions)
for (const auto &faction : factionChanges.factions)
{
// If the player isn't in this faction, make them join it
if (!ptrNpcStats.isInFaction(faction.factionId))
@ -973,7 +973,7 @@ void LocalPlayer::setFactions()
void LocalPlayer::setKills()
{
for(const auto &kill : killChanges.kills)
for (const auto &kill : killChanges.kills)
MWBase::Environment::get().getMechanicsManager()->setDeaths(kill.refId, kill.number);
}
@ -982,7 +982,7 @@ void LocalPlayer::setBooks()
MWWorld::Ptr player = getPlayerPtr();
MWMechanics::NpcStats &ptrNpcStats = player.getClass().getNpcStats(player);
for(const auto &book : bookChanges.books)
for (const auto &book : bookChanges.books)
ptrNpcStats.flagAsUsed(book.bookId);
}
@ -1014,7 +1014,7 @@ void LocalPlayer::sendInventory()
inventoryChanges.items.clear();
for(const auto &iter : ptrInventory)
for (const auto &iter : ptrInventory)
{
item.refId = iter.getCellRef().getRefId();
if (item.refId.find("$dynamic") != string::npos) // skip generated items (self enchanted for e.g.)
@ -1040,7 +1040,7 @@ void LocalPlayer::sendSpellbook()
spellbookChanges.spells.clear();
// Send spells in spellbook, while ignoring abilities, powers, etc.
for(const auto &spell : ptrSpells)
for (const auto &spell : ptrSpells)
{
if (spell.first->mData.mType == ESM::Spell::ST_Spell)
spellbookChanges.spells.push_back(*spell.first);

@ -327,7 +327,7 @@ bool Main::isValidPacketScript(std::string script)
"ouch_wraithguard"
};
for(const auto &validPacketScript : validPacketScripts)
for (const auto &validPacketScript : validPacketScripts)
{
if (Misc::StringUtils::ciEqual(script, validPacketScript))
return true;

@ -40,7 +40,7 @@ void MechanicsHelper::spawnLeveledCreatures(MWWorld::CellStore* cellStore)
int spawnCount = 0;
for(auto &lref : creatureLevList->mList)
for (auto &lref : creatureLevList->mList)
{
MWWorld::Ptr ptr(&lref, cellStore);

@ -20,7 +20,7 @@ bool ActorProcessor::Process(RakNet::Packet &packet, ActorList &actorList)
myPacket->setActorList(&actorList);
myPacket->SetReadStream(&bsIn);
for(auto &processor : processors)
for (auto &processor : processors)
{
if (processor.first == packet.data[0])
{
@ -47,7 +47,7 @@ bool ActorProcessor::Process(RakNet::Packet &packet, ActorList &actorList)
void ActorProcessor::AddProcessor(mwmp::ActorProcessor *processor)
{
for(auto &p : processors)
for (auto &p : processors)
{
if (processor->packetID == p.first)
throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " +

@ -12,7 +12,7 @@ PlayerProcessor::processors_t PlayerProcessor::processors;
void PlayerProcessor::AddProcessor(PlayerProcessor *processor)
{
for(auto &p : processors)
for (auto &p : processors)
{
if (processor->packetID == p.first)
throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " +
@ -34,7 +34,7 @@ bool PlayerProcessor::Process(RakNet::Packet &packet)
// error: packet not found
}*/
for(auto &processor : processors)
for (auto &processor : processors)
{
if (processor.first == packet.data[0])
{

@ -20,7 +20,7 @@ bool WorldProcessor::Process(RakNet::Packet &packet, WorldEvent &event)
myPacket->setEvent(&event);
myPacket->SetReadStream(&bsIn);
for(auto &processor: processors)
for (auto &processor: processors)
{
if (processor.first == packet.data[0])
{
@ -45,7 +45,7 @@ bool WorldProcessor::Process(RakNet::Packet &packet, WorldEvent &event)
void WorldProcessor::AddProcessor(mwmp::WorldProcessor *processor)
{
for(auto &p : processors)
for (auto &p : processors)
{
if (processor->packetID == p.first)
throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " +

Loading…
Cancel
Save