mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-24 00:00:13 +00:00
Initial commit: wowee native WoW 3.3.5a client
This commit is contained in:
commit
ce6cb8f38e
147 changed files with 32347 additions and 0 deletions
37
src/game/entity.cpp
Normal file
37
src/game/entity.cpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#include "game/entity.hpp"
|
||||
#include "core/logger.hpp"
|
||||
|
||||
namespace wowee {
|
||||
namespace game {
|
||||
|
||||
void EntityManager::addEntity(uint64_t guid, std::shared_ptr<Entity> entity) {
|
||||
if (!entity) {
|
||||
LOG_WARNING("Attempted to add null entity with GUID: 0x", std::hex, guid, std::dec);
|
||||
return;
|
||||
}
|
||||
|
||||
entities[guid] = entity;
|
||||
|
||||
LOG_DEBUG("Added entity: GUID=0x", std::hex, guid, std::dec,
|
||||
", Type=", static_cast<int>(entity->getType()));
|
||||
}
|
||||
|
||||
void EntityManager::removeEntity(uint64_t guid) {
|
||||
auto it = entities.find(guid);
|
||||
if (it != entities.end()) {
|
||||
LOG_DEBUG("Removed entity: GUID=0x", std::hex, guid, std::dec);
|
||||
entities.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<Entity> EntityManager::getEntity(uint64_t guid) const {
|
||||
auto it = entities.find(guid);
|
||||
return (it != entities.end()) ? it->second : nullptr;
|
||||
}
|
||||
|
||||
bool EntityManager::hasEntity(uint64_t guid) const {
|
||||
return entities.find(guid) != entities.end();
|
||||
}
|
||||
|
||||
} // namespace game
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue