diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 2b595dbfb..eb0554901 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -1057,11 +1057,10 @@ bool ChatHandler::HandleGameObjectAddCommand(char* args) if (!ExtractOptInt32(&args, spawntimeSecs, 0)) return false; - const GameObjectInfo *gInfo = ObjectMgr::GetGameObjectInfo(id); - + const GameObjectInfo* gInfo = ObjectMgr::GetGameObjectInfo(id); if (!gInfo) { - PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST,id); + PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, id); SetSentErrorMessage(true); return false; } @@ -1069,20 +1068,18 @@ bool ChatHandler::HandleGameObjectAddCommand(char* args) if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId)) { // report to DB errors log as in loading case - sLog.outErrorDb("Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.",id, gInfo->type, gInfo->displayId); - PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA,id); + sLog.outErrorDb("Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", id, gInfo->type, gInfo->displayId); + PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA, id); SetSentErrorMessage(true); return false; } - Player *chr = m_session->GetPlayer(); - float x = float(chr->GetPositionX()); - float y = float(chr->GetPositionY()); - float z = float(chr->GetPositionZ()); - float o = float(chr->GetOrientation()); - Map *map = chr->GetMap(); - - GameObject* pGameObj = new GameObject; + Player* plr = m_session->GetPlayer(); + float x = float(plr->GetPositionX()); + float y = float(plr->GetPositionY()); + float z = float(plr->GetPositionZ()); + float o = float(plr->GetOrientation()); + Map* map = plr->GetMap(); // used guids from specially reserved range (can be 0 if no free values) uint32 db_lowGUID = sObjectMgr.GenerateStaticGameObjectLowGuid(); @@ -1093,7 +1090,8 @@ bool ChatHandler::HandleGameObjectAddCommand(char* args) return false; } - if (!pGameObj->Create(db_lowGUID, gInfo->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o)) + GameObject* pGameObj = new GameObject; + if (!pGameObj->Create(db_lowGUID, gInfo->id, map, plr->GetPhaseMaskForSpawn(), x, y, z, o)) { delete pGameObj; return false; @@ -1103,7 +1101,7 @@ bool ChatHandler::HandleGameObjectAddCommand(char* args) pGameObj->SetRespawnTime(spawntimeSecs); // fill the gameobject data and save to the db - pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()),chr->GetPhaseMaskForSpawn()); + pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), plr->GetPhaseMaskForSpawn()); // this will generate a new guid if the object is in an instance if (!pGameObj->LoadFromDB(db_lowGUID, map)) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 94af4e247..8916b055d 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11986" + #define REVISION_NR "11987" #endif // __REVISION_NR_H__