Core/Commands: Fixed creature/gameobject move commands not updating which cell they belong to

Closes #22720

(cherry picked from commit ec1cfa36f4)
This commit is contained in:
Shauren
2019-01-15 16:54:57 +01:00
parent b1b5a6a591
commit dcd69240b6
2 changed files with 6 additions and 0 deletions

View File

@@ -497,7 +497,11 @@ public:
Map* map = object->GetMap();
object->Relocate(x, y, z, object->GetOrientation());
// update which cell has this gameobject registered for loading
sObjectMgr->RemoveGameobjectFromGrid(guidLow, object->GetGameObjectData());
object->SaveToDB();
sObjectMgr->AddGameobjectToGrid(guidLow, object->GetGameObjectData());
// Generate a completely new spawn with new guid
// 3.3.5a client caches recently deleted objects and brings them back to life

View File

@@ -819,7 +819,9 @@ public:
}
// update position in memory
sObjectMgr->RemoveCreatureFromGrid(lowguid, data);
const_cast<CreatureData*>(data)->spawnPoint.Relocate(*player);
sObjectMgr->AddCreatureToGrid(lowguid, data);
// update position in DB
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_POSITION);