mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-31 21:45:33 +00:00
d4dbfdfdb6
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
47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
//
|
|
// Created by koncord on 03.04.17.
|
|
//
|
|
|
|
#include "WorldProcessor.hpp"
|
|
#include "Networking.hpp"
|
|
|
|
using namespace mwmp;
|
|
|
|
template<class T>
|
|
typename BasePacketProcessor<T>::processors_t BasePacketProcessor<T>::processors;
|
|
|
|
void WorldProcessor::Do(ObjectPacket &packet, const std::shared_ptr<Player> &player, BaseObjectList &objectList)
|
|
{
|
|
packet.Send(true);
|
|
}
|
|
|
|
bool WorldProcessor::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;
|
|
}
|