mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-05 18:24:12 +00:00
Move EntityManager to Game namespace (#1140)
* 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
This commit is contained in:
@@ -27,7 +27,7 @@ BehaviorEndEntry::BehaviorEndEntry() {
|
||||
}
|
||||
|
||||
uint32_t BehaviorContext::GetUniqueSkillId() const {
|
||||
auto* entity = EntityManager::Instance()->GetEntity(this->originator);
|
||||
auto* entity = Game::entityManager->GetEntity(this->originator);
|
||||
|
||||
if (entity == nullptr) {
|
||||
Game::logger->Log("BehaviorContext", "Invalid entity for (%llu)!", this->originator);
|
||||
@@ -94,11 +94,11 @@ void BehaviorContext::ScheduleUpdate(const LWOOBJID id) {
|
||||
|
||||
void BehaviorContext::ExecuteUpdates() {
|
||||
for (const auto& id : this->scheduledUpdates) {
|
||||
auto* entity = EntityManager::Instance()->GetEntity(id);
|
||||
auto* entity = Game::entityManager->GetEntity(id);
|
||||
|
||||
if (entity == nullptr) continue;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(entity);
|
||||
Game::entityManager->SerializeEntity(entity);
|
||||
}
|
||||
|
||||
this->scheduledUpdates.clear();
|
||||
@@ -308,7 +308,7 @@ void BehaviorContext::Reset() {
|
||||
}
|
||||
|
||||
std::vector<LWOOBJID> BehaviorContext::GetValidTargets(int32_t ignoreFaction, int32_t includeFaction, bool targetSelf, bool targetEnemy, bool targetFriend) const {
|
||||
auto* entity = EntityManager::Instance()->GetEntity(this->caster);
|
||||
auto* entity = Game::entityManager->GetEntity(this->caster);
|
||||
|
||||
std::vector<LWOOBJID> targets;
|
||||
|
||||
@@ -320,7 +320,7 @@ std::vector<LWOOBJID> BehaviorContext::GetValidTargets(int32_t ignoreFaction, in
|
||||
|
||||
if (!ignoreFaction && !includeFaction) {
|
||||
for (auto entry : entity->GetTargetsInPhantom()) {
|
||||
auto* instance = EntityManager::Instance()->GetEntity(entry);
|
||||
auto* instance = Game::entityManager->GetEntity(entry);
|
||||
|
||||
if (instance == nullptr) {
|
||||
continue;
|
||||
@@ -336,7 +336,7 @@ std::vector<LWOOBJID> BehaviorContext::GetValidTargets(int32_t ignoreFaction, in
|
||||
return targets;
|
||||
}
|
||||
|
||||
auto entities = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS);
|
||||
auto entities = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS);
|
||||
for (auto* candidate : entities) {
|
||||
const auto id = candidate->GetObjectID();
|
||||
|
||||
|
Reference in New Issue
Block a user