You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3mp/apps/openmw-mp/processors/ObjectProcessor.cpp

48 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;
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
7 years ago
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)
Merge pull request #423 from TES3MP/0.6.3 while resolving conflicts Conflicts: apps/openmw-mp/Networking.cpp apps/openmw-mp/Script/Functions/World.cpp apps/openmw-mp/Script/Functions/World.hpp apps/openmw-mp/processors/WorldProcessor.cpp apps/openmw-mp/processors/WorldProcessor.hpp apps/openmw-mp/processors/world/ProcessorContainer.hpp apps/openmw-mp/processors/world/ProcessorDoorState.hpp apps/openmw-mp/processors/world/ProcessorObjectDelete.hpp apps/openmw-mp/processors/world/ProcessorObjectLock.hpp apps/openmw-mp/processors/world/ProcessorObjectPlace.hpp apps/openmw-mp/processors/world/ProcessorObjectScale.hpp apps/openmw-mp/processors/world/ProcessorObjectSpawn.hpp apps/openmw-mp/processors/world/ProcessorObjectState.hpp apps/openmw-mp/processors/world/ProcessorObjectTrap.hpp apps/openmw/mwgui/container.cpp apps/openmw/mwmp/Networking.cpp apps/openmw/mwmp/ObjectList.cpp apps/openmw/mwmp/ObjectList.hpp apps/openmw/mwmp/processors/world/ProcessorContainer.hpp components/CMakeLists.txt components/openmw-mp/Base/BaseObject.hpp components/openmw-mp/Packets/Object/ObjectPacket.cpp components/openmw-mp/Packets/Object/PacketConsoleCommand.cpp components/openmw-mp/Packets/Object/PacketContainer.cpp components/openmw-mp/Packets/Object/PacketDoorState.hpp components/openmw-mp/Packets/Object/PacketMusicPlay.hpp components/openmw-mp/Packets/Object/PacketObjectAnimPlay.hpp components/openmw-mp/Packets/Object/PacketObjectLock.hpp components/openmw-mp/Packets/Object/PacketObjectMove.hpp components/openmw-mp/Packets/Object/PacketObjectPlace.hpp components/openmw-mp/Packets/Object/PacketObjectRotate.hpp components/openmw-mp/Packets/Object/PacketObjectScale.hpp components/openmw-mp/Packets/Object/PacketObjectSpawn.hpp components/openmw-mp/Packets/Object/PacketObjectState.hpp components/openmw-mp/Packets/Object/PacketObjectTrap.hpp components/openmw-mp/Packets/Object/PacketScriptGlobalShort.hpp components/openmw-mp/Packets/Object/PacketScriptLocalFloat.hpp components/openmw-mp/Packets/Object/PacketScriptLocalShort.hpp components/openmw-mp/Packets/Object/PacketScriptMemberShort.hpp components/openmw-mp/Packets/Object/PacketVideoPlay.hpp
7 years ago
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;
}