mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-21 22:14:08 +00:00
[Client] Reorder methods and don't set variables that are no longer used
This commit is contained in:
parent
d3f3fb5d05
commit
f52fc19762
3 changed files with 53 additions and 54 deletions
|
@ -52,11 +52,11 @@ void Cell::updateLocal()
|
|||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
worldObject.pos = actor->position;
|
||||
worldObject.direction = actor->direction;
|
||||
worldObject.drawState = actor->drawState;
|
||||
worldObject.movementFlags = actor->movementFlags;
|
||||
|
||||
worldObject.headPitch = actor->headPitch;
|
||||
worldObject.headYaw = actor->headYaw;
|
||||
|
||||
worldObject.hasAnimation = actor->hasAnimation;
|
||||
worldObject.hasAnimStates = actor->hasAnimStates;
|
||||
worldObject.hasMovement = actor->hasMovement;
|
||||
|
@ -101,6 +101,61 @@ void Cell::updateDedicated(float dt)
|
|||
}
|
||||
}
|
||||
|
||||
void Cell::readCellFrame(WorldEvent& worldEvent)
|
||||
{
|
||||
WorldObject worldObject;
|
||||
|
||||
for (unsigned int i = 0; i < worldEvent.objectChanges.count; i++)
|
||||
{
|
||||
worldObject = worldEvent.objectChanges.objects.at(i);
|
||||
std::string mapIndex = Main::get().getCellController()->generateMapIndex(worldObject);
|
||||
|
||||
// If this key doesn't exist, create it
|
||||
if (dedicatedActors.count(mapIndex) == 0)
|
||||
{
|
||||
MWWorld::Ptr ptrFound = store->searchExact(worldObject.refId, worldObject.refNumIndex, worldObject.mpNum);
|
||||
|
||||
if (!ptrFound) return;
|
||||
|
||||
DedicatedActor *actor = new DedicatedActor();
|
||||
actor->cell = worldEvent.cell;
|
||||
actor->setPtr(ptrFound);
|
||||
dedicatedActors[mapIndex] = actor;
|
||||
|
||||
Main::get().getCellController()->setDedicatedActorRecord(mapIndex, getDescription());
|
||||
|
||||
LOG_APPEND(Log::LOG_INFO, "- Initialized DedicatedActor %s", mapIndex.c_str());
|
||||
}
|
||||
|
||||
// If this now exists, set its details
|
||||
if (dedicatedActors.count(mapIndex) > 0)
|
||||
{
|
||||
DedicatedActor *actor = dedicatedActors[mapIndex];
|
||||
actor->position = worldObject.pos;
|
||||
actor->drawState = worldObject.drawState;
|
||||
|
||||
actor->hasAnimation = worldObject.hasAnimation;
|
||||
actor->hasAnimStates = worldObject.hasAnimStates;
|
||||
actor->hasMovement = worldObject.hasMovement;
|
||||
|
||||
if (actor->hasAnimation)
|
||||
{
|
||||
actor->animation = worldObject.animation;
|
||||
}
|
||||
|
||||
if (actor->hasAnimStates)
|
||||
{
|
||||
actor->animStates = worldObject.animStates;
|
||||
}
|
||||
|
||||
if (actor->hasMovement)
|
||||
{
|
||||
actor->movement = worldObject.movement;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Cell::initializeLocalActors()
|
||||
{
|
||||
ESM::Cell esmCell = *store->getCell();
|
||||
|
@ -148,62 +203,6 @@ void Cell::uninitializeDedicatedActors()
|
|||
dedicatedActors.clear();
|
||||
}
|
||||
|
||||
void Cell::readCellFrame(WorldEvent& worldEvent)
|
||||
{
|
||||
WorldObject worldObject;
|
||||
|
||||
for (unsigned int i = 0; i < worldEvent.objectChanges.count; i++)
|
||||
{
|
||||
worldObject = worldEvent.objectChanges.objects.at(i);
|
||||
std::string mapIndex = Main::get().getCellController()->generateMapIndex(worldObject);
|
||||
|
||||
// If this key doesn't exist, create it
|
||||
if (dedicatedActors.count(mapIndex) == 0)
|
||||
{
|
||||
MWWorld::Ptr ptrFound = store->searchExact(worldObject.refId, worldObject.refNumIndex, worldObject.mpNum);
|
||||
|
||||
if (!ptrFound) return;
|
||||
|
||||
DedicatedActor *actor = new DedicatedActor();
|
||||
actor->cell = worldEvent.cell;
|
||||
actor->setPtr(ptrFound);
|
||||
dedicatedActors[mapIndex] = actor;
|
||||
|
||||
Main::get().getCellController()->setDedicatedActorRecord(mapIndex, getDescription());
|
||||
|
||||
LOG_APPEND(Log::LOG_INFO, "- Initialized DedicatedActor %s", mapIndex.c_str());
|
||||
}
|
||||
|
||||
// If this now exists, set its details
|
||||
if (dedicatedActors.count(mapIndex) > 0)
|
||||
{
|
||||
DedicatedActor *actor = dedicatedActors[mapIndex];
|
||||
actor->position = worldObject.pos;
|
||||
actor->direction = worldObject.direction;
|
||||
actor->drawState = worldObject.drawState;
|
||||
actor->movementFlags = worldObject.movementFlags;
|
||||
actor->hasAnimation = worldObject.hasAnimation;
|
||||
actor->hasAnimStates = worldObject.hasAnimStates;
|
||||
actor->hasMovement = worldObject.hasMovement;
|
||||
|
||||
if (actor->hasAnimation)
|
||||
{
|
||||
actor->animation = worldObject.animation;
|
||||
}
|
||||
|
||||
if (actor->hasAnimStates)
|
||||
{
|
||||
actor->animStates = worldObject.animStates;
|
||||
}
|
||||
|
||||
if (actor->hasMovement)
|
||||
{
|
||||
actor->movement = worldObject.movement;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LocalActor *Cell::getLocalActor(std::string actorIndex)
|
||||
{
|
||||
return localActors.at(actorIndex);
|
||||
|
|
|
@ -18,12 +18,12 @@ namespace mwmp
|
|||
void updateLocal();
|
||||
void updateDedicated(float dt);
|
||||
|
||||
void readCellFrame(mwmp::WorldEvent& worldEvent);
|
||||
|
||||
void initializeLocalActors();
|
||||
void uninitializeLocalActors();
|
||||
void uninitializeDedicatedActors();
|
||||
|
||||
void readCellFrame(mwmp::WorldEvent& worldEvent);
|
||||
|
||||
virtual LocalActor *getLocalActor(std::string actorIndex);
|
||||
virtual DedicatedActor *getDedicatedActor(std::string actorIndex);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ using namespace std;
|
|||
|
||||
DedicatedActor::DedicatedActor()
|
||||
{
|
||||
movementFlags = 0;
|
||||
|
||||
}
|
||||
|
||||
DedicatedActor::~DedicatedActor()
|
||||
|
|
Loading…
Reference in a new issue