mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-27 23:21:20 -04:00
[Client] Check validity of refIds in ObjectSpawn packets
This reverts c7bcf70c321f9103898e71c22797674501e19fed because it provides a better solution to the problem solved there, while solving another related problem as well.
This commit is contained in:
parent
8d286657d4
commit
7995466e3c
@ -6,6 +6,7 @@
|
|||||||
#include "DedicatedPlayer.hpp"
|
#include "DedicatedPlayer.hpp"
|
||||||
#include "PlayerList.hpp"
|
#include "PlayerList.hpp"
|
||||||
#include "CellController.hpp"
|
#include "CellController.hpp"
|
||||||
|
#include "RecordHelper.hpp"
|
||||||
|
|
||||||
#include <components/openmw-mp/Log.hpp>
|
#include <components/openmw-mp/Log.hpp>
|
||||||
|
|
||||||
@ -375,7 +376,7 @@ void ObjectList::placeObjects(MWWorld::CellStore* cellStore)
|
|||||||
}
|
}
|
||||||
catch (std::exception&)
|
catch (std::exception&)
|
||||||
{
|
{
|
||||||
LOG_APPEND(Log::LOG_INFO, "-- Ignored placement of invalid object");
|
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Ignored placement of invalid object %s", baseObject.refId.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -393,6 +394,11 @@ void ObjectList::spawnObjects(MWWorld::CellStore* cellStore)
|
|||||||
// Ignore generic dynamic refIds because they could be anything on other clients
|
// Ignore generic dynamic refIds because they could be anything on other clients
|
||||||
if (baseObject.refId.find("$dynamic") != string::npos)
|
if (baseObject.refId.find("$dynamic") != string::npos)
|
||||||
continue;
|
continue;
|
||||||
|
else if (!RecordHelper::doesCreatureExist(baseObject.refId) && !RecordHelper::doesNpcExist(baseObject.refId))
|
||||||
|
{
|
||||||
|
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Ignored spawning of invalid object %s", baseObject.refId.c_str());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
MWWorld::Ptr ptrFound = cellStore->searchExact(0, baseObject.mpNum);
|
MWWorld::Ptr ptrFound = cellStore->searchExact(0, baseObject.mpNum);
|
||||||
|
|
||||||
@ -402,8 +408,6 @@ void ObjectList::spawnObjects(MWWorld::CellStore* cellStore)
|
|||||||
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), baseObject.refId, 1);
|
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), baseObject.refId, 1);
|
||||||
MWWorld::Ptr newPtr = ref.getPtr();
|
MWWorld::Ptr newPtr = ref.getPtr();
|
||||||
|
|
||||||
if (newPtr.getClass().isActor())
|
|
||||||
{
|
|
||||||
newPtr = MWBase::Environment::get().getWorld()->placeObject(newPtr, cellStore, baseObject.position);
|
newPtr = MWBase::Environment::get().getWorld()->placeObject(newPtr, cellStore, baseObject.position);
|
||||||
MWMechanics::CreatureStats& creatureStats = newPtr.getClass().getCreatureStats(newPtr);
|
MWMechanics::CreatureStats& creatureStats = newPtr.getClass().getCreatureStats(newPtr);
|
||||||
|
|
||||||
@ -439,9 +443,6 @@ void ObjectList::spawnObjects(MWWorld::CellStore* cellStore)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
LOG_APPEND(Log::LOG_VERBOSE, "-- Cannot spawn non-actor object!");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
LOG_APPEND(Log::LOG_VERBOSE, "-- Actor already existed!");
|
LOG_APPEND(Log::LOG_VERBOSE, "-- Actor already existed!");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user