2017-04-02 21:46:46 +00:00
|
|
|
#ifndef OPENMW_PROCESSOROBJECTPLACE_HPP
|
|
|
|
#define OPENMW_PROCESSOROBJECTPLACE_HPP
|
|
|
|
|
2017-07-03 17:13:10 +00:00
|
|
|
#include "../WorldProcessor.hpp"
|
2017-04-04 06:23:34 +00:00
|
|
|
#include <apps/openmw-mp/Networking.hpp>
|
2017-04-02 21:46:46 +00:00
|
|
|
|
|
|
|
namespace mwmp
|
|
|
|
{
|
|
|
|
class ProcessorObjectPlace : public WorldProcessor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ProcessorObjectPlace()
|
|
|
|
{
|
|
|
|
BPP_INIT(ID_OBJECT_PLACE)
|
|
|
|
}
|
|
|
|
|
|
|
|
void Do(WorldPacket &packet, Player &player, BaseEvent &event) override
|
|
|
|
{
|
2017-04-08 09:00:07 +00:00
|
|
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str());
|
|
|
|
|
2017-05-06 18:57:14 +00:00
|
|
|
for (unsigned int i = 0; i < event.worldObjectCount; i++)
|
2017-04-04 06:23:34 +00:00
|
|
|
{
|
2017-05-06 18:57:14 +00:00
|
|
|
event.worldObjects.at(i).mpNum = mwmp::Networking::getPtr()->incrementMpNum();
|
2017-04-04 06:23:34 +00:00
|
|
|
}
|
|
|
|
|
2017-04-04 08:43:33 +00:00
|
|
|
// Send this packet back to the original sender with the mpNum generation from above,
|
|
|
|
// then send it to the other players
|
|
|
|
packet.Send(false);
|
2017-04-02 21:46:46 +00:00
|
|
|
packet.Send(true);
|
|
|
|
|
|
|
|
Script::Call<Script::CallbackIdentity("OnObjectPlace")>(player.getId(), event.cell.getDescription().c_str());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //OPENMW_PROCESSOROBJECTPLACE_HPP
|