diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index d8671b05f..5c931ab0d 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -586,37 +586,34 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map) if (!Create(guid,entry, map, phaseMask, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state) ) return false; - switch(GetGOInfo()->type) + if(!GetDespawnPossibility()) { - case GAMEOBJECT_TYPE_DOOR: - case GAMEOBJECT_TYPE_BUTTON: - /* this code (in comment) isn't correct because in battlegrounds we need despawnable doors and buttons, pls remove - SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN); + SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN); + m_spawnedByDefault = true; + m_respawnDelayTime = 0; + m_respawnTime = 0; + } + else + { + if(data->spawntimesecs >= 0) + { m_spawnedByDefault = true; - m_respawnDelayTime = 0; - m_respawnTime = 0; - break;*/ - default: - if(data->spawntimesecs >= 0) - { - m_spawnedByDefault = true; - m_respawnDelayTime = data->spawntimesecs; - m_respawnTime = objmgr.GetGORespawnTime(m_DBTableGuid, map->GetInstanceId()); + m_respawnDelayTime = data->spawntimesecs; + m_respawnTime = objmgr.GetGORespawnTime(m_DBTableGuid, map->GetInstanceId()); - // ready to respawn - if(m_respawnTime && m_respawnTime <= time(NULL)) - { - m_respawnTime = 0; - objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0); - } - } - else + // ready to respawn + if(m_respawnTime && m_respawnTime <= time(NULL)) { - m_spawnedByDefault = false; - m_respawnDelayTime = -data->spawntimesecs; m_respawnTime = 0; + objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0); } - break; + } + else + { + m_spawnedByDefault = false; + m_respawnDelayTime = -data->spawntimesecs; + m_respawnTime = 0; + } } return true; diff --git a/src/game/GameObject.h b/src/game/GameObject.h index 1c9322a6f..8fdea4d2f 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -479,6 +479,20 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject } } + bool GetDespawnPossibility() const + { + switch(GetGoType()) + { + case GAMEOBJECT_TYPE_DOOR: return GetGOInfo()->door.noDamageImmune; + case GAMEOBJECT_TYPE_BUTTON: return GetGOInfo()->button.noDamageImmune; + case GAMEOBJECT_TYPE_QUESTGIVER: return GetGOInfo()->questgiver.noDamageImmune; + case GAMEOBJECT_TYPE_GOOBER: return GetGOInfo()->goober.noDamageImmune; + case GAMEOBJECT_TYPE_FLAGSTAND: return GetGOInfo()->flagstand.noDamageImmune; + case GAMEOBJECT_TYPE_FLAGDROP: return GetGOInfo()->flagdrop.noDamageImmune; + default: return true; + } + } + time_t GetRespawnTime() const { return m_respawnTime; } time_t GetRespawnTimeEx() const { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d21b4a455..a4c76e945 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 "7633" + #define REVISION_NR "7634" #endif // __REVISION_NR_H__