[General] Use vector::at in most places

This commit is contained in:
David Cernat 2017-02-05 19:01:06 +02:00
parent 60d6a6d463
commit 75392297b5
22 changed files with 40 additions and 40 deletions

View file

@ -51,7 +51,7 @@ void LocalEvent::editContainer(MWWorld::CellStore* cellStore)
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < objectChanges.count; i++)
{ {
worldObject = objectChanges.objects[i]; worldObject = objectChanges.objects.at(i);
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
worldObject.refId.c_str(), worldObject.refId.c_str(),
@ -100,7 +100,7 @@ void LocalEvent::placeObjects(MWWorld::CellStore* cellStore)
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < objectChanges.count; i++)
{ {
worldObject = objectChanges.objects[i]; worldObject = objectChanges.objects.at(i);
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s\n- charge: %i\n- count: %i", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s\n- charge: %i\n- count: %i",
worldObject.refId.c_str(), worldObject.refId.c_str(),
@ -138,7 +138,7 @@ void LocalEvent::deleteObjects(MWWorld::CellStore* cellStore)
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < objectChanges.count; i++)
{ {
worldObject = objectChanges.objects[i]; worldObject = objectChanges.objects.at(i);
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
worldObject.refId.c_str(), worldObject.refId.c_str(),
@ -164,7 +164,7 @@ void LocalEvent::lockObjects(MWWorld::CellStore* cellStore)
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < objectChanges.count; i++)
{ {
worldObject = objectChanges.objects[i]; worldObject = objectChanges.objects.at(i);
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
worldObject.refId.c_str(), worldObject.refId.c_str(),
@ -190,7 +190,7 @@ void LocalEvent::unlockObjects(MWWorld::CellStore* cellStore)
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < objectChanges.count; i++)
{ {
worldObject = objectChanges.objects[i]; worldObject = objectChanges.objects.at(i);
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
worldObject.refId.c_str(), worldObject.refId.c_str(),
@ -216,7 +216,7 @@ void LocalEvent::scaleObjects(MWWorld::CellStore* cellStore)
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < objectChanges.count; i++)
{ {
worldObject = objectChanges.objects[i]; worldObject = objectChanges.objects.at(i);
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
worldObject.refId.c_str(), worldObject.refId.c_str(),
@ -242,7 +242,7 @@ void LocalEvent::moveObjects(MWWorld::CellStore* cellStore)
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < objectChanges.count; i++)
{ {
worldObject = objectChanges.objects[i]; worldObject = objectChanges.objects.at(i);
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
worldObject.refId.c_str(), worldObject.refId.c_str(),
@ -269,7 +269,7 @@ void LocalEvent::rotateObjects(MWWorld::CellStore* cellStore)
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < objectChanges.count; i++)
{ {
worldObject = objectChanges.objects[i]; worldObject = objectChanges.objects.at(i);
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
worldObject.refId.c_str(), worldObject.refId.c_str(),
@ -296,7 +296,7 @@ void LocalEvent::animateObjects(MWWorld::CellStore* cellStore)
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < objectChanges.count; i++)
{ {
worldObject = objectChanges.objects[i]; worldObject = objectChanges.objects.at(i);
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
worldObject.refId.c_str(), worldObject.refId.c_str(),
@ -323,7 +323,7 @@ void LocalEvent::activateDoors(MWWorld::CellStore* cellStore)
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < objectChanges.count; i++)
{ {
worldObject = objectChanges.objects[i]; worldObject = objectChanges.objects.at(i);
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
worldObject.refId.c_str(), worldObject.refId.c_str(),
@ -350,7 +350,7 @@ void LocalEvent::playMusic()
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < objectChanges.count; i++)
{ {
worldObject = objectChanges.objects[i]; worldObject = objectChanges.objects.at(i);
LOG_APPEND(Log::LOG_WARN, "- filename: %s", LOG_APPEND(Log::LOG_WARN, "- filename: %s",
worldObject.filename.c_str()); worldObject.filename.c_str());
@ -365,7 +365,7 @@ void LocalEvent::playVideo()
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < objectChanges.count; i++)
{ {
worldObject = objectChanges.objects[i]; worldObject = objectChanges.objects.at(i);
LOG_APPEND(Log::LOG_WARN, "- filename: %s\n- allowSkipping: %s", LOG_APPEND(Log::LOG_WARN, "- filename: %s\n- allowSkipping: %s",
worldObject.filename.c_str(), worldObject.filename.c_str(),
@ -381,7 +381,7 @@ void LocalEvent::setLocalShorts(MWWorld::CellStore* cellStore)
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < objectChanges.count; i++)
{ {
worldObject = objectChanges.objects[i]; worldObject = objectChanges.objects.at(i);
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s\n- index: %i\n- shortVal: %i", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s\n- index: %i\n- shortVal: %i",
worldObject.refId.c_str(), worldObject.refId.c_str(),
@ -409,7 +409,7 @@ void LocalEvent::setLocalFloats(MWWorld::CellStore* cellStore)
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < objectChanges.count; i++)
{ {
worldObject = objectChanges.objects[i]; worldObject = objectChanges.objects.at(i);
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s\n- index: %i\n- floatVal: %f", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s\n- index: %i\n- floatVal: %f",
worldObject.refId.c_str(), worldObject.refId.c_str(),
@ -437,7 +437,7 @@ void LocalEvent::setMemberShorts()
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < objectChanges.count; i++)
{ {
worldObject = objectChanges.objects[i]; worldObject = objectChanges.objects.at(i);
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s\n- index: %i\n- shortVal: %i\n", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s\n- index: %i\n- shortVal: %i\n",
worldObject.refId.c_str(), worldObject.refId.c_str(),
@ -469,7 +469,7 @@ void LocalEvent::setGlobalShorts()
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < objectChanges.count; i++)
{ {
worldObject = objectChanges.objects[i]; worldObject = objectChanges.objects.at(i);
LOG_APPEND(Log::LOG_WARN, "- varName: %s\n- shortVal: %i", LOG_APPEND(Log::LOG_WARN, "- varName: %s\n- shortVal: %i",
worldObject.varName.c_str(), worldObject.varName.c_str(),

View file

@ -636,7 +636,7 @@ void LocalPlayer::addItems()
for (unsigned int i = 0; i < inventoryChanges.count; i++) for (unsigned int i = 0; i < inventoryChanges.count; i++)
{ {
mwmp::Item item = inventoryChanges.items[i]; mwmp::Item item = inventoryChanges.items.at(i);
MWWorld::Ptr itemPtr = *ptrStore.add(item.refId, item.count, ptrPlayer); MWWorld::Ptr itemPtr = *ptrStore.add(item.refId, item.count, ptrPlayer);
if (item.charge != -1) if (item.charge != -1)
itemPtr.getCellRef().setCharge(item.charge); itemPtr.getCellRef().setCharge(item.charge);
@ -657,7 +657,7 @@ void LocalPlayer::addJournalItems()
{ {
for (unsigned int i = 0; i < journalChanges.count; i++) for (unsigned int i = 0; i < journalChanges.count; i++)
{ {
mwmp::JournalItem journalItem = journalChanges.journalItems[i]; mwmp::JournalItem journalItem = journalChanges.journalItems.at(i);
if (journalItem.type == JournalItem::ENTRY) if (journalItem.type == JournalItem::ENTRY)
{ {
@ -688,7 +688,7 @@ void LocalPlayer::removeItems()
for (unsigned int i = 0; i < inventoryChanges.count; i++) for (unsigned int i = 0; i < inventoryChanges.count; i++)
{ {
mwmp::Item item = inventoryChanges.items[i]; mwmp::Item item = inventoryChanges.items.at(i);
ptrStore.remove(item.refId, item.count, ptrPlayer); ptrStore.remove(item.refId, item.count, ptrPlayer);
} }
} }

View file

@ -26,7 +26,7 @@ void mwmp::PacketPlayerCellState::Packet(RakNet::BitStream *bs, mwmp::BasePlayer
if (send) if (send)
{ {
cellState = player->cellStateChanges.cellStates[i]; cellState = player->cellStateChanges.cellStates.at(i);
} }
RW(cellState.type, send); RW(cellState.type, send);

View file

@ -32,7 +32,7 @@ void PacketPlayerInventory::Packet(RakNet::BitStream *bs, BasePlayer *player, bo
if (send) if (send)
{ {
item = player->inventoryChanges.items[i]; item = player->inventoryChanges.items.at(i);
} }
RW(item.refId, send); RW(item.refId, send);

View file

@ -25,7 +25,7 @@ void PacketPlayerJournal::Packet(RakNet::BitStream *bs, BasePlayer *player, bool
JournalItem journalItem; JournalItem journalItem;
if (send) if (send)
journalItem = player->journalChanges.journalItems[i]; journalItem = player->journalChanges.journalItems.at(i);
RW(journalItem.type, send); RW(journalItem.type, send);
RW(journalItem.quest, send); RW(journalItem.quest, send);

View file

@ -28,7 +28,7 @@ void PacketPlayerSpellbook::Packet(RakNet::BitStream *bs, BasePlayer *player, bo
if (send) if (send)
{ {
spell = player->spellbookChanges.spells[i]; spell = player->spellbookChanges.spells.at(i);
} }
RW(spell.mId, send); RW(spell.mId, send);

View file

@ -39,7 +39,7 @@ void PacketContainer::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects[i]; worldObject = event->objectChanges.objects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);
@ -57,7 +57,7 @@ void PacketContainer::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send
{ {
if (send) if (send)
{ {
containerItem = event->containerChanges.items[i]; containerItem = event->containerChanges.items.at(i);
} }
RW(containerItem.refId, send); RW(containerItem.refId, send);

View file

@ -30,7 +30,7 @@ void PacketDoorState::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects[i]; worldObject = event->objectChanges.objects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);

View file

@ -25,7 +25,7 @@ void PacketMusicPlay::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects[i]; worldObject = event->objectChanges.objects.at(i);
} }
RW(worldObject.filename, send); RW(worldObject.filename, send);

View file

@ -30,7 +30,7 @@ void PacketObjectAnimPlay::Packet(RakNet::BitStream *bs, WorldEvent *event, bool
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects[i]; worldObject = event->objectChanges.objects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);

View file

@ -30,7 +30,7 @@ void PacketObjectDelete::Packet(RakNet::BitStream *bs, WorldEvent *event, bool s
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects[i]; worldObject = event->objectChanges.objects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);

View file

@ -30,7 +30,7 @@ void PacketObjectLock::Packet(RakNet::BitStream *bs, WorldEvent *event, bool sen
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects[i]; worldObject = event->objectChanges.objects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);

View file

@ -30,7 +30,7 @@ void PacketObjectMove::Packet(RakNet::BitStream *bs, WorldEvent *event, bool sen
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects[i]; worldObject = event->objectChanges.objects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);

View file

@ -30,7 +30,7 @@ void PacketObjectPlace::Packet(RakNet::BitStream *bs, WorldEvent *event, bool se
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects[i]; worldObject = event->objectChanges.objects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);

View file

@ -30,7 +30,7 @@ void PacketObjectRotate::Packet(RakNet::BitStream *bs, WorldEvent *event, bool s
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects[i]; worldObject = event->objectChanges.objects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);

View file

@ -30,7 +30,7 @@ void PacketObjectScale::Packet(RakNet::BitStream *bs, WorldEvent *event, bool se
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects[i]; worldObject = event->objectChanges.objects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);

View file

@ -30,7 +30,7 @@ void PacketObjectUnlock::Packet(RakNet::BitStream *bs, WorldEvent *event, bool s
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects[i]; worldObject = event->objectChanges.objects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);

View file

@ -25,7 +25,7 @@ void PacketScriptGlobalShort::Packet(RakNet::BitStream *bs, WorldEvent *event, b
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects[i]; worldObject = event->objectChanges.objects.at(i);
} }
RW(worldObject.varName, send); RW(worldObject.varName, send);

View file

@ -30,7 +30,7 @@ void PacketScriptLocalFloat::Packet(RakNet::BitStream *bs, WorldEvent *event, bo
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects[i]; worldObject = event->objectChanges.objects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);

View file

@ -30,7 +30,7 @@ void PacketScriptLocalShort::Packet(RakNet::BitStream *bs, WorldEvent *event, bo
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects[i]; worldObject = event->objectChanges.objects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);

View file

@ -25,7 +25,7 @@ void PacketScriptMemberShort::Packet(RakNet::BitStream *bs, WorldEvent *event, b
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects[i]; worldObject = event->objectChanges.objects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);

View file

@ -25,7 +25,7 @@ void PacketVideoPlay::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects[i]; worldObject = event->objectChanges.objects.at(i);
} }
RW(worldObject.filename, send); RW(worldObject.filename, send);