mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-10 18:28:21 +00:00
455f9470a5
* Move EntityManager to Game namespace * move initialization to later Need to wait for dZoneManager to be initialized. * Fix bugs - Cannot delete from a RandomAccessIterator while in a range based for loop. Touchup zone manager initialize replace magic numbers with better named constants replace magic zonecontrol id with a more readable hex alternative condense stack variables move initializers closer to their use initialize entity manager with zone control change initialize timings If zone is not zero we expect to initialize the entity manager during zone manager initialization Add constexpr for zone control LOT * Add proper error handling * revert vanity changes * Update WorldServer.cpp * Update dZoneManager.cpp
27 lines
976 B
C++
27 lines
976 B
C++
#include "ZoneSGServer.h"
|
|
#include "EntityManager.h"
|
|
|
|
void ZoneSGServer::OnStartup(Entity* self) {
|
|
const auto cannons = Game::entityManager->GetEntitiesByLOT(1864);
|
|
for (const auto& cannon : cannons)
|
|
self->SetVar<LWOOBJID>(CannonIDVariable, cannon->GetObjectID());
|
|
}
|
|
|
|
void ZoneSGServer::OnActivityStateChangeRequest(Entity* self, const LWOOBJID senderID, const int32_t value1,
|
|
const int32_t value2, const std::u16string& stringValue) {
|
|
|
|
auto* cannon = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(CannonIDVariable));
|
|
if (cannon != nullptr) {
|
|
cannon->OnActivityStateChangeRequest(senderID, value1, value2, stringValue);
|
|
}
|
|
}
|
|
|
|
void ZoneSGServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
|
int32_t param3) {
|
|
|
|
auto* cannon = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(CannonIDVariable));
|
|
if (cannon != nullptr) {
|
|
cannon->OnFireEventServerSide(sender, args, param1, param2, param3);
|
|
}
|
|
}
|