1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-31 12:45:31 +00:00
openmw-tes3mp/apps/openmw-mp/processors/ObjectProcessor.cpp
David Cernat b5922d18fd Merge pull request #428 from TES3MP/0.6.3 while resolving conflicts
# Conflicts:
#   apps/openmw-mp/Networking.cpp
#   apps/openmw-mp/Script/Functions/Objects.cpp
#   apps/openmw-mp/Script/Functions/Objects.hpp
#   apps/openmw-mp/processors/ObjectProcessor.cpp
#   apps/openmw-mp/processors/object/ProcessorContainer.hpp
#   apps/openmw-mp/processors/object/ProcessorDoorState.hpp
#   apps/openmw-mp/processors/object/ProcessorMusicPlay.hpp
#   apps/openmw-mp/processors/object/ProcessorObjectAnimPlay.hpp
#   apps/openmw-mp/processors/object/ProcessorObjectDelete.hpp
#   apps/openmw-mp/processors/object/ProcessorObjectLock.hpp
#   apps/openmw-mp/processors/object/ProcessorObjectMove.hpp
#   apps/openmw-mp/processors/object/ProcessorObjectPlace.hpp
#   apps/openmw-mp/processors/object/ProcessorObjectRotate.hpp
#   apps/openmw-mp/processors/object/ProcessorObjectScale.hpp
#   apps/openmw-mp/processors/object/ProcessorObjectSpawn.hpp
#   apps/openmw-mp/processors/object/ProcessorObjectState.hpp
#   apps/openmw-mp/processors/object/ProcessorObjectTrap.hpp
#   apps/openmw-mp/processors/object/ProcessorScriptGlobalFloat.hpp
#   apps/openmw-mp/processors/object/ProcessorScriptGlobalShort.hpp
#   apps/openmw-mp/processors/object/ProcessorScriptLocalFloat.hpp
#   apps/openmw-mp/processors/object/ProcessorScriptLocalShort.hpp
#   apps/openmw-mp/processors/object/ProcessorScriptMemberFloat.hpp
#   apps/openmw-mp/processors/object/ProcessorScriptMemberShort.hpp
#   apps/openmw-mp/processors/object/ProcessorVideoPlay.hpp
#   apps/openmw/mwmp/Networking.cpp
#   apps/openmw/mwmp/processors/object/BaseObjectProcessor.hpp
#   apps/openmw/mwmp/processors/object/ProcessorMusicPlay.hpp
#   apps/openmw/mwmp/processors/object/ProcessorScriptGlobalFloat.hpp
#   apps/openmw/mwmp/processors/object/ProcessorScriptGlobalShort.hpp
#   apps/openmw/mwmp/processors/object/ProcessorScriptMemberFloat.hpp
#   apps/openmw/mwmp/processors/object/ProcessorScriptMemberShort.hpp
#   apps/openmw/mwmp/processors/object/ProcessorVideoPlay.hpp
2018-05-16 06:28:24 +03:00

47 lines
1.4 KiB
C++

//
// Created by koncord on 03.04.17.
//
#include "ObjectProcessor.hpp"
#include "Networking.hpp"
using namespace mwmp;
template<class T>
typename BasePacketProcessor<T>::processors_t BasePacketProcessor<T>::processors;
void ObjectProcessor::Do(ObjectPacket &packet, const std::shared_ptr<Player> &player, BaseObjectList &objectList)
{
packet.Send(true);
}
bool ObjectProcessor::Process(RakNet::Packet &packet, BaseObjectList &objectList) noexcept
{
// Clear our BaseObjectList before loading new data in it
objectList.cell.blank();
objectList.baseObjects.clear();
objectList.guid = packet.guid;
for (auto &processor : processors)
{
if (processor.first == packet.data[0])
{
auto player = Players::getPlayerByGUID(packet.guid);
ObjectPacket *myPacket = Networking::get().getObjectPacketController()->GetPacket(packet.data[0]);
myPacket->setObjectList(&objectList);
objectList.isValid = true;
if (!processor.second->avoidReading)
myPacket->Read();
if (objectList.isValid)
processor.second->Do(*myPacket, player, objectList);
else
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Received %s that failed integrity check and was ignored!", processor.second->strPacketID.c_str());
return true;
}
}
return false;
}