aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Creature
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2020-02-08 20:22:37 +0100
committerGitHub <noreply@github.com>2020-02-08 20:22:37 +0100
commit9304e496cbf6ab6c028671fb8526c732ae5d799f (patch)
tree997040bf14477bbd30b9b175aac93fa287de03e1 /src/server/game/Entities/Creature
parent726d5e91b55d4742dcbd6b0a82d84788dbb117b7 (diff)
Core/Misc: Some refactoring, #23603 prep: (#23676)
- Split SpawnMetadata off from SpawnData - No longer allocate Creature/Gameobject objects in ObjectGridLoader just to check their typeid and delete them afterwards Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com>
Diffstat (limited to 'src/server/game/Entities/Creature')
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp12
-rw-r--r--src/server/game/Entities/Creature/Creature.h2
2 files changed, 10 insertions, 4 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 0e76a98d8a0..0cc0c86eca1 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -1324,9 +1324,15 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
data.displayid = displayId;
data.equipmentId = GetCurrentEquipmentId();
if (!GetTransport())
- data.spawnPoint.WorldRelocate(this);
+ {
+ data.mapId = GetMapId();
+ data.spawnPoint.Relocate(this);
+ }
else
- data.spawnPoint.WorldRelocate(mapid, GetTransOffsetX(), GetTransOffsetY(), GetTransOffsetZ(), GetTransOffsetO());
+ {
+ data.mapId = mapid;
+ data.spawnPoint.Relocate(GetTransOffsetX(), GetTransOffsetY(), GetTransOffsetZ(), GetTransOffsetO());
+ }
data.spawntimesecs = m_respawnDelay;
// prevent add data integrity problems
data.spawndist = GetDefaultMovementType() == IDLE_MOTION_TYPE ? 0.0f : m_respawnradius;
@@ -1733,7 +1739,7 @@ bool Creature::hasInvolvedQuest(uint32 quest_id) const
SQLTransaction trans = CharacterDatabase.BeginTransaction();
- sMapMgr->DoForAllMapsWithMapId(data->spawnPoint.GetMapId(),
+ sMapMgr->DoForAllMapsWithMapId(data->mapId,
[spawnId, trans](Map* map) -> void
{
// despawn all active creatures, and remove their respawns
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 5d485774f20..84aea18e5b3 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -82,7 +82,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
void Update(uint32 time) override; // overwrited Unit::Update
void GetRespawnPosition(float &x, float &y, float &z, float* ori = nullptr, float* dist = nullptr) const;
- bool IsSpawnedOnTransport() const { return m_creatureData && m_creatureData->spawnPoint.GetMapId() != GetMapId(); }
+ bool IsSpawnedOnTransport() const { return m_creatureData && m_creatureData->mapId != GetMapId(); }
void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
uint32 GetCorpseDelay() const { return m_corpseDelay; }