Update PerformIngameSpawn() (#202)

Update PerformIngameSpawn() when spawning a gobject with the save boolean set on true, so the gobject will spawn ingame just like in the cs_gobject.cpp file, instead of not spawning at all.
This commit is contained in:
Nicolas Viseur
2016-07-02 09:14:11 +02:00
committed by Rochet2
parent efd63dc259
commit e686bcb33f

View File

@@ -1719,7 +1719,13 @@ namespace LuaGlobalFunctions
{
// fill the gameobject data and save to the db
object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase);
guidLow = object->GetSpawnId();
// delete the old object and do a clean load from DB with a fresh new GameObject instance.
// this is required to avoid weird behavior and memory leaks
delete object;
object = new GameObject();
// this will generate a new lowguid if the object is in an instance
if (!object->LoadGameObjectFromDB(guidLow, map))
{