CScriptLayer: Make use of prefix increment on iterators

This commit is contained in:
Lioncash 2020-06-18 04:46:38 -04:00
parent 363b19ebe6
commit 2b7c322e59
1 changed files with 5 additions and 4 deletions

View File

@ -35,14 +35,15 @@ public:
std::advance(it, Index); std::advance(it, Index);
mInstances.insert(it, pObject); mInstances.insert(it, pObject);
} }
else else
{
mInstances.push_back(pObject); mInstances.push_back(pObject);
} }
}
void RemoveInstance(CScriptObject *pInstance) void RemoveInstance(CScriptObject *pInstance)
{ {
for (auto it = mInstances.begin(); it != mInstances.end(); it++) for (auto it = mInstances.begin(); it != mInstances.end(); ++it)
{ {
if (*it == pInstance) if (*it == pInstance)
{ {
@ -59,7 +60,7 @@ public:
void RemoveInstanceByID(uint32 ID) void RemoveInstanceByID(uint32 ID)
{ {
for (auto it = mInstances.begin(); it != mInstances.end(); it++) for (auto it = mInstances.begin(); it != mInstances.end(); ++it)
{ {
if ((*it)->InstanceID() == ID) if ((*it)->InstanceID() == ID)
{ {
@ -84,7 +85,7 @@ public:
CScriptObject* InstanceByID(uint32 ID) const CScriptObject* InstanceByID(uint32 ID) const
{ {
for (auto it = mInstances.begin(); it != mInstances.end(); it++) for (auto it = mInstances.begin(); it != mInstances.end(); ++it)
{ {
if ((*it)->InstanceID() == ID) if ((*it)->InstanceID() == ID)
return *it; return *it;