[Server] Rename ClearScriptEvent into InitScriptEvent with pid argument

pull/168/head
David Cernat 8 years ago
parent 868c837aa0
commit af35ee38d1

@ -15,10 +15,14 @@ ContainerItem tempContainerItem;
std::regex exteriorCellPattern("^(-?\\d+), (-?\\d+)$"); std::regex exteriorCellPattern("^(-?\\d+), (-?\\d+)$");
void WorldFunctions::ClearScriptEvent() noexcept void WorldFunctions::InitScriptEvent(unsigned short pid) noexcept
{ {
Player *player;
GET_PLAYER(pid, player, );
scriptEvent.cell.blank(); scriptEvent.cell.blank();
scriptEvent.objectChanges.objects.clear(); scriptEvent.objectChanges.objects.clear();
scriptEvent.guid = player->guid;
} }
unsigned int WorldFunctions::GetObjectChangesSize() noexcept unsigned int WorldFunctions::GetObjectChangesSize() noexcept
@ -256,60 +260,39 @@ void WorldFunctions::AddContainerItem() noexcept
tempWorldObject.containerChanges.items.push_back(containerItem); tempWorldObject.containerChanges.items.push_back(containerItem);
} }
void WorldFunctions::SendObjectDelete(unsigned short pid) noexcept void WorldFunctions::SendObjectDelete() noexcept
{ {
Player *player; mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_DELETE)->Send(&scriptEvent, scriptEvent.guid);
GET_PLAYER(pid, player, );
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_DELETE)->Send(&scriptEvent, player->guid);
} }
void WorldFunctions::SendObjectPlace(unsigned short pid) noexcept void WorldFunctions::SendObjectPlace() noexcept
{ {
Player *player; mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_PLACE)->Send(&scriptEvent, scriptEvent.guid);
GET_PLAYER(pid, player, );
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_PLACE)->Send(&scriptEvent, player->guid);
} }
void WorldFunctions::SendObjectScale(unsigned short pid) noexcept void WorldFunctions::SendObjectScale() noexcept
{ {
Player *player; mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_SCALE)->Send(&scriptEvent, scriptEvent.guid);
GET_PLAYER(pid, player, );
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_SCALE)->Send(&scriptEvent, player->guid);
} }
void WorldFunctions::SendObjectLock(unsigned short pid) noexcept void WorldFunctions::SendObjectLock() noexcept
{ {
Player *player; mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_LOCK)->Send(&scriptEvent, scriptEvent.guid);
GET_PLAYER(pid, player, );
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_LOCK)->Send(&scriptEvent, player->guid);
} }
void WorldFunctions::SendObjectUnlock(unsigned short pid) noexcept void WorldFunctions::SendObjectUnlock() noexcept
{ {
Player *player; mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_UNLOCK)->Send(&scriptEvent, scriptEvent.guid);
GET_PLAYER(pid, player, );
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_UNLOCK)->Send(&scriptEvent, player->guid);
} }
void WorldFunctions::SendDoorState(unsigned short pid) noexcept void WorldFunctions::SendDoorState() noexcept
{ {
Player *player; mwmp::Networking::get().getWorldController()->GetPacket(ID_DOOR_STATE)->Send(&scriptEvent, scriptEvent.guid);
GET_PLAYER(pid, player, );
mwmp::Networking::get().getWorldController()->GetPacket(ID_DOOR_STATE)->Send(&scriptEvent, player->guid);
} }
void WorldFunctions::SendContainer(unsigned short pid) noexcept void WorldFunctions::SendContainer() noexcept
{ {
Player *player; mwmp::Networking::get().getWorldController()->GetPacket(ID_CONTAINER)->Send(&scriptEvent, scriptEvent.guid);
GET_PLAYER(pid, player, );
mwmp::Networking::get().getWorldController()->GetPacket(ID_CONTAINER)->Send(&scriptEvent, player->guid);
} }
void WorldFunctions::SetHour(unsigned short pid, double hour) noexcept void WorldFunctions::SetHour(unsigned short pid, double hour) noexcept

@ -2,7 +2,7 @@
#define OPENMW_WORLD_HPP #define OPENMW_WORLD_HPP
#define WORLDFUNCTIONS \ #define WORLDFUNCTIONS \
{"ClearScriptEvent", WorldFunctions::ClearScriptEvent},\ {"InitScriptEvent", WorldFunctions::InitScriptEvent},\
\ \
{"GetObjectChangesSize", WorldFunctions::GetObjectChangesSize},\ {"GetObjectChangesSize", WorldFunctions::GetObjectChangesSize},\
{"GetLastEventAction", WorldFunctions::GetLastEventAction},\ {"GetLastEventAction", WorldFunctions::GetLastEventAction},\
@ -65,7 +65,7 @@ class WorldFunctions
{ {
public: public:
static void ClearScriptEvent() noexcept; static void InitScriptEvent(unsigned short pid) noexcept;
static unsigned int GetObjectChangesSize() noexcept; static unsigned int GetObjectChangesSize() noexcept;
static unsigned int GetLastEventAction() noexcept; static unsigned int GetLastEventAction() noexcept;
@ -112,13 +112,13 @@ public:
static void AddWorldObject() noexcept; static void AddWorldObject() noexcept;
static void AddContainerItem() noexcept; static void AddContainerItem() noexcept;
static void SendObjectDelete(unsigned short pid) noexcept; static void SendObjectDelete() noexcept;
static void SendObjectPlace(unsigned short pid) noexcept; static void SendObjectPlace() noexcept;
static void SendObjectScale(unsigned short pid) noexcept; static void SendObjectScale() noexcept;
static void SendObjectLock(unsigned short pid) noexcept; static void SendObjectLock() noexcept;
static void SendObjectUnlock(unsigned short pid) noexcept; static void SendObjectUnlock() noexcept;
static void SendDoorState(unsigned short pid) noexcept; static void SendDoorState() noexcept;
static void SendContainer(unsigned short pid) noexcept; static void SendContainer() noexcept;
static void SetHour(unsigned short pid, double hour) noexcept; static void SetHour(unsigned short pid, double hour) noexcept;
static void SetMonth(unsigned short pid, int month) noexcept; static void SetMonth(unsigned short pid, int month) noexcept;

Loading…
Cancel
Save