From e36027e90b03164c06337a5eb52bcf3f46cf5341 Mon Sep 17 00:00:00 2001 From: Elron103 Date: Sun, 11 Mar 2012 15:45:21 +0100 Subject: Core/Misc: Add a validity check for coordinates, prevents crashes --- src/server/game/Entities/Object/Object.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index c1ecc3b74e7..a86a007c76a 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2674,6 +2674,14 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float pos.m_positionZ += 2.0f; destx = pos.m_positionX + dist * cos(angle); desty = pos.m_positionY + dist * sin(angle); + + // Prevent invalid coordinates here, position is unchanged + if (!Trinity::IsValidMapCoord(destx, desty)) + { + sLog->outCrash("WorldObject::MovePositionToFirstCollision invalid coordinates X: %f and Y: %f were passed!", destx, desty); + return; + } + ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true); floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true); destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor; -- cgit v1.2.3 From abed18d695d1e04787826b41793316202b1ab93a Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 9 Apr 2012 17:36:10 +0200 Subject: Core/DBLayer: More type fixes --- src/server/scripts/Commands/cs_reload.cpp | 164 +++++++++++++++--------------- 1 file changed, 81 insertions(+), 83 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 5f192ffceee..1c119fdef4c 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -424,7 +424,7 @@ public: continue; } - CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry); + CreatureTemplate* cInfo = const_cast(sObjectMgr->GetCreatureTemplate(entry)); if (!cInfo) { handler->PSendSysMessage(LANG_COMMAND_CREATURESTORAGE_NOTFOUND, entry); @@ -435,90 +435,88 @@ public: Field* fields = result->Fetch(); - const_cast(cInfo)->DifficultyEntry[0] = fields[0].GetUInt32(); - const_cast(cInfo)->DifficultyEntry[1] = fields[1].GetUInt32(); - const_cast(cInfo)->DifficultyEntry[2] = fields[2].GetUInt32(); - const_cast(cInfo)->KillCredit[0] = fields[3].GetUInt32(); - const_cast(cInfo)->KillCredit[1] = fields[4].GetUInt32(); - const_cast(cInfo)->Modelid1 = fields[5].GetUInt32(); - const_cast(cInfo)->Modelid2 = fields[6].GetUInt32(); - const_cast(cInfo)->Modelid3 = fields[7].GetUInt32(); - const_cast(cInfo)->Modelid4 = fields[8].GetUInt32(); - const_cast(cInfo)->Name = fields[9].GetString(); - const_cast(cInfo)->SubName = fields[10].GetString(); - const_cast(cInfo)->IconName = fields[11].GetString(); - const_cast(cInfo)->GossipMenuId = fields[12].GetUInt32(); - const_cast(cInfo)->minlevel = fields[13].GetUInt32(); - const_cast(cInfo)->maxlevel = fields[14].GetUInt32(); - const_cast(cInfo)->expansion = fields[15].GetUInt32(); - const_cast(cInfo)->faction_A = fields[16].GetUInt32(); - const_cast(cInfo)->faction_H = fields[17].GetUInt32(); - const_cast(cInfo)->npcflag = fields[18].GetUInt32(); - const_cast(cInfo)->speed_walk = fields[19].GetFloat(); - const_cast(cInfo)->speed_run = fields[20].GetFloat(); - const_cast(cInfo)->scale = fields[21].GetFloat(); - const_cast(cInfo)->rank = fields[22].GetUInt32(); - const_cast(cInfo)->mindmg = fields[23].GetFloat(); - const_cast(cInfo)->maxdmg = fields[24].GetFloat(); - const_cast(cInfo)->dmgschool = fields[25].GetUInt32(); - const_cast(cInfo)->attackpower = fields[26].GetUInt32(); - const_cast(cInfo)->dmg_multiplier = fields[27].GetFloat(); - const_cast(cInfo)->baseattacktime = fields[28].GetUInt32(); - const_cast(cInfo)->rangeattacktime = fields[29].GetUInt32(); - const_cast(cInfo)->unit_class = fields[30].GetUInt32(); - const_cast(cInfo)->unit_flags = fields[31].GetUInt32(); - const_cast(cInfo)->dynamicflags = fields[32].GetUInt32(); - const_cast(cInfo)->family = fields[33].GetUInt32(); - const_cast(cInfo)->trainer_type = fields[34].GetUInt32(); - const_cast(cInfo)->trainer_spell = fields[35].GetUInt32(); - const_cast(cInfo)->trainer_class = fields[36].GetUInt32(); - const_cast(cInfo)->trainer_race = fields[37].GetUInt32(); - const_cast(cInfo)->minrangedmg = fields[38].GetFloat(); - const_cast(cInfo)->maxrangedmg = fields[39].GetFloat(); - const_cast(cInfo)->rangedattackpower = fields[40].GetUInt32(); - const_cast(cInfo)->type = fields[41].GetUInt32(); - const_cast(cInfo)->type_flags = fields[42].GetUInt32(); - const_cast(cInfo)->lootid = fields[43].GetUInt32(); - const_cast(cInfo)->pickpocketLootId = fields[44].GetUInt32(); - const_cast(cInfo)->SkinLootId = fields[45].GetUInt32(); + cInfo->DifficultyEntry[0] = fields[0].GetUInt32(); + cInfo->DifficultyEntry[1] = fields[1].GetUInt32(); + cInfo->DifficultyEntry[2] = fields[2].GetUInt32(); + cInfo->KillCredit[0] = fields[3].GetUInt32(); + cInfo->KillCredit[1] = fields[4].GetUInt32(); + cInfo->Modelid1 = fields[5].GetUInt32(); + cInfo->Modelid2 = fields[6].GetUInt32(); + cInfo->Modelid3 = fields[7].GetUInt32(); + cInfo->Modelid4 = fields[8].GetUInt32(); + cInfo->Name = fields[9].GetString(); + cInfo->SubName = fields[10].GetString(); + cInfo->IconName = fields[11].GetString(); + cInfo->GossipMenuId = fields[12].GetUInt32(); + cInfo->minlevel = fields[13].GetUInt8(); + cInfo->maxlevel = fields[14].GetUInt8(); + cInfo->expansion = fields[15].GetUInt16(); + cInfo->faction_A = fields[16].GetUInt16(); + cInfo->faction_H = fields[17].GetUInt16(); + cInfo->npcflag = fields[18].GetUInt32(); + cInfo->speed_walk = fields[19].GetFloat(); + cInfo->speed_run = fields[20].GetFloat(); + cInfo->scale = fields[21].GetFloat(); + cInfo->rank = fields[22].GetUInt8(); + cInfo->mindmg = fields[23].GetFloat(); + cInfo->maxdmg = fields[24].GetFloat(); + cInfo->dmgschool = fields[25].GetUInt8(); + cInfo->attackpower = fields[26].GetUInt32(); + cInfo->dmg_multiplier = fields[27].GetFloat(); + cInfo->baseattacktime = fields[28].GetUInt32(); + cInfo->rangeattacktime = fields[29].GetUInt32(); + cInfo->unit_class = fields[30].GetUInt8(); + cInfo->unit_flags = fields[31].GetUInt32(); + cInfo->dynamicflags = fields[32].GetUInt32(); + cInfo->family = fields[33].GetUInt8(); + cInfo->trainer_type = fields[34].GetUInt8(); + cInfo->trainer_spell = fields[35].GetUInt32(); + cInfo->trainer_class = fields[36].GetUInt8(); + cInfo->trainer_race = fields[37].GetUInt8(); + cInfo->minrangedmg = fields[38].GetFloat(); + cInfo->maxrangedmg = fields[39].GetFloat(); + cInfo->rangedattackpower = fields[40].GetUInt16(); + cInfo->type = fields[41].GetUInt8(); + cInfo->type_flags = fields[42].GetUInt32(); + cInfo->lootid = fields[43].GetUInt32(); + cInfo->pickpocketLootId = fields[44].GetUInt32(); + cInfo->SkinLootId = fields[45].GetUInt32(); for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) - { - const_cast(cInfo)->resistance[i] = fields[46 + i -1].GetUInt32(); - } - - const_cast(cInfo)->spells[0] = fields[52].GetUInt32(); - const_cast(cInfo)->spells[1] = fields[53].GetUInt32(); - const_cast(cInfo)->spells[2] = fields[54].GetUInt32(); - const_cast(cInfo)->spells[3] = fields[55].GetUInt32(); - const_cast(cInfo)->spells[4] = fields[56].GetUInt32(); - const_cast(cInfo)->spells[5] = fields[57].GetUInt32(); - const_cast(cInfo)->spells[6] = fields[58].GetUInt32(); - const_cast(cInfo)->spells[7] = fields[59].GetUInt32(); - const_cast(cInfo)->PetSpellDataId = fields[60].GetUInt32(); - const_cast(cInfo)->VehicleId = fields[61].GetUInt32(); - const_cast(cInfo)->mingold = fields[62].GetUInt32(); - const_cast(cInfo)->maxgold = fields[63].GetUInt32(); - const_cast(cInfo)->AIName = fields[64].GetString(); - const_cast(cInfo)->MovementType = fields[65].GetUInt32(); - const_cast(cInfo)->InhabitType = fields[66].GetUInt32(); - const_cast(cInfo)->HoverHeight = fields[67].GetFloat(); - const_cast(cInfo)->ModHealth = fields[68].GetFloat(); - const_cast(cInfo)->ModMana = fields[69].GetFloat(); - const_cast(cInfo)->ModArmor = fields[70].GetFloat(); - const_cast(cInfo)->RacialLeader = fields[71].GetBool(); - const_cast(cInfo)->questItems[0] = fields[72].GetUInt32(); - const_cast(cInfo)->questItems[1] = fields[73].GetUInt32(); - const_cast(cInfo)->questItems[2] = fields[74].GetUInt32(); - const_cast(cInfo)->questItems[3] = fields[75].GetUInt32(); - const_cast(cInfo)->questItems[4] = fields[76].GetUInt32(); - const_cast(cInfo)->questItems[5] = fields[77].GetUInt32(); - const_cast(cInfo)->movementId = fields[78].GetUInt32(); - const_cast(cInfo)->RegenHealth = fields[79].GetBool(); - const_cast(cInfo)->equipmentId = fields[80].GetUInt32(); - const_cast(cInfo)->MechanicImmuneMask = fields[81].GetUInt32(); - const_cast(cInfo)->flags_extra = fields[82].GetUInt32(); - const_cast(cInfo)->ScriptID = sObjectMgr->GetScriptId(fields[83].GetCString()); + cInfo->resistance[i] = fields[46 + i -1].GetUInt16(); + + cInfo->spells[0] = fields[52].GetUInt32(); + cInfo->spells[1] = fields[53].GetUInt32(); + cInfo->spells[2] = fields[54].GetUInt32(); + cInfo->spells[3] = fields[55].GetUInt32(); + cInfo->spells[4] = fields[56].GetUInt32(); + cInfo->spells[5] = fields[57].GetUInt32(); + cInfo->spells[6] = fields[58].GetUInt32(); + cInfo->spells[7] = fields[59].GetUInt32(); + cInfo->PetSpellDataId = fields[60].GetUInt32(); + cInfo->VehicleId = fields[61].GetUInt32(); + cInfo->mingold = fields[62].GetUInt32(); + cInfo->maxgold = fields[63].GetUInt32(); + cInfo->AIName = fields[64].GetString(); + cInfo->MovementType = fields[65].GetUInt8(); + cInfo->InhabitType = fields[66].GetUInt8(); + cInfo->HoverHeight = fields[67].GetFloat(); + cInfo->ModHealth = fields[68].GetFloat(); + cInfo->ModMana = fields[69].GetFloat(); + cInfo->ModArmor = fields[70].GetFloat(); + cInfo->RacialLeader = fields[71].GetBool(); + cInfo->questItems[0] = fields[72].GetUInt32(); + cInfo->questItems[1] = fields[73].GetUInt32(); + cInfo->questItems[2] = fields[74].GetUInt32(); + cInfo->questItems[3] = fields[75].GetUInt32(); + cInfo->questItems[4] = fields[76].GetUInt32(); + cInfo->questItems[5] = fields[77].GetUInt32(); + cInfo->movementId = fields[78].GetUInt32(); + cInfo->RegenHealth = fields[79].GetBool(); + cInfo->equipmentId = fields[80].GetUInt32(); + cInfo->MechanicImmuneMask = fields[81].GetUInt32(); + cInfo->flags_extra = fields[82].GetUInt32(); + cInfo->ScriptID = sObjectMgr->GetScriptId(fields[83].GetCString()); sObjectMgr->CheckCreatureTemplate(cInfo); } -- cgit v1.2.3 From 5d7d635b9ed1250878f6287e676f3387e1fb1dc7 Mon Sep 17 00:00:00 2001 From: click Date: Tue, 10 Apr 2012 02:06:10 +0200 Subject: Core: Add proper log output in Player::Create functions, warning admins about possible hackers during character creation --- src/server/game/Entities/Player/Player.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 1fa88ce86e7..b94a7a59664 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -932,7 +932,8 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(createInfo->Race, createInfo->Class); if (!info) { - sLog->outError("Player (Name %s) has incorrect race/class pair. Can't be loaded.", m_name.c_str()); + sLog->outError("Player::Create: Possible hacking-attempt: Account '%s' tried creating a character named '%s' with an invalid race/class pair (%u/%u) - refusing to do so.", + GetSession()->GetAccountId(), m_name.c_str(), createInfo->Race, createInfo->Class); return false; } @@ -944,7 +945,8 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(createInfo->Class); if (!cEntry) { - sLog->outError("Class %u not found in DBC (Wrong DBC files?)", createInfo->Class); + sLog->outError("Player::Create: Possible hacking-attempt: Account '%s' tried creating a character named '%s' with an invalid character class (%u) - refusing to do so (wrong DBC-files?)", + GetSession()->GetAccountId(), m_name.c_str(), createInfo->Class); return false; } @@ -959,7 +961,8 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) if (!IsValidGender(createInfo->Gender)) { - sLog->outError("Player has invalid gender (%hu), can't be loaded.", createInfo->Gender); + sLog->outError("Player::Create: Possible hacking-attempt: Account '%s' tried creating a character named '%s' with an invalid gender (%hu) - refusing to do so", + GetSession()->GetAccountId(), m_name.c_str(), createInfo->Gender); return false; } -- cgit v1.2.3 From a470a5ad93420255338502f48339d13a0aa7bcb0 Mon Sep 17 00:00:00 2001 From: click Date: Tue, 10 Apr 2012 02:11:27 +0200 Subject: Fix a typo in previous commit --- src/server/game/Entities/Player/Player.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index b94a7a59664..26ea7c110d2 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -932,7 +932,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(createInfo->Race, createInfo->Class); if (!info) { - sLog->outError("Player::Create: Possible hacking-attempt: Account '%s' tried creating a character named '%s' with an invalid race/class pair (%u/%u) - refusing to do so.", + sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid race/class pair (%u/%u) - refusing to do so.", GetSession()->GetAccountId(), m_name.c_str(), createInfo->Race, createInfo->Class); return false; } @@ -945,7 +945,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(createInfo->Class); if (!cEntry) { - sLog->outError("Player::Create: Possible hacking-attempt: Account '%s' tried creating a character named '%s' with an invalid character class (%u) - refusing to do so (wrong DBC-files?)", + sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid character class (%u) - refusing to do so (wrong DBC-files?)", GetSession()->GetAccountId(), m_name.c_str(), createInfo->Class); return false; } @@ -961,7 +961,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) if (!IsValidGender(createInfo->Gender)) { - sLog->outError("Player::Create: Possible hacking-attempt: Account '%s' tried creating a character named '%s' with an invalid gender (%hu) - refusing to do so", + sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%hu) - refusing to do so", GetSession()->GetAccountId(), m_name.c_str(), createInfo->Gender); return false; } -- cgit v1.2.3 From 6c5cabcf8ba42cc3118696c231a973523fc1d2ca Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 10 Apr 2012 20:04:45 -0500 Subject: Battlegrounds/WSG: Fixed door LoS in Warsong Gulch Closes #6147 Signed-off-by: Subv --- src/server/game/Battlegrounds/Battleground.cpp | 8 +++----- src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp | 4 ++-- src/server/game/Entities/GameObject/GameObject.cpp | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index f3c393eaa36..d6bfde021e7 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1459,9 +1459,8 @@ void Battleground::DoorClose(uint32 type) // If doors are open, close it if (obj->getLootState() == GO_ACTIVATED && obj->GetGoState() != GO_STATE_READY) { - // Change state to allow door to be closed obj->SetLootState(GO_READY); - obj->UseDoorOrButton(RESPAWN_ONE_DAY); + obj->SetGoState(GO_STATE_READY); } } else @@ -1473,9 +1472,8 @@ void Battleground::DoorOpen(uint32 type) { if (GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type])) { - // Change state to be sure they will be opened - obj->SetLootState(GO_READY); - obj->UseDoorOrButton(RESPAWN_ONE_DAY); + obj->SetLootState(GO_ACTIVATED); + obj->SetGoState(GO_STATE_ACTIVE); } else sLog->outError("Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 86ad749b8b7..656c8897f9d 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -179,9 +179,9 @@ void BattlegroundWS::StartingEventCloseDoors() void BattlegroundWS::StartingEventOpenDoors() { - for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_A_4; ++i) + for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_A_6; ++i) DoorOpen(i); - for (uint32 i = BG_WS_OBJECT_DOOR_H_1; i <= BG_WS_OBJECT_DOOR_H_2; ++i) + for (uint32 i = BG_WS_OBJECT_DOOR_H_1; i <= BG_WS_OBJECT_DOOR_H_4; ++i) DoorOpen(i); SpawnBGObject(BG_WS_OBJECT_DOOR_A_5, RESPAWN_ONE_DAY); diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index cc53d0eb79f..bf1fc6ac706 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -138,7 +138,7 @@ void GameObject::AddToWorld() bool toggledState = GetGoState() == GO_STATE_READY; if (m_model) GetMap()->Insert(*m_model); - if ((startOpen && !toggledState) || (!startOpen && toggledState)) + if (startOpen ^ toggledState) EnableCollision(false); WorldObject::AddToWorld(); -- cgit v1.2.3 From e9ac667cce1e3e12dddf6c1deb3009f841cb486e Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 10 Apr 2012 20:09:24 -0500 Subject: Battlegrounds/WSG: Missing change from my previous commit --- src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 656c8897f9d..5a60e371204 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -184,11 +184,6 @@ void BattlegroundWS::StartingEventOpenDoors() for (uint32 i = BG_WS_OBJECT_DOOR_H_1; i <= BG_WS_OBJECT_DOOR_H_4; ++i) DoorOpen(i); - SpawnBGObject(BG_WS_OBJECT_DOOR_A_5, RESPAWN_ONE_DAY); - SpawnBGObject(BG_WS_OBJECT_DOOR_A_6, RESPAWN_ONE_DAY); - SpawnBGObject(BG_WS_OBJECT_DOOR_H_3, RESPAWN_ONE_DAY); - SpawnBGObject(BG_WS_OBJECT_DOOR_H_4, RESPAWN_ONE_DAY); - for (uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; ++i) SpawnBGObject(i, RESPAWN_IMMEDIATELY); -- cgit v1.2.3 From a998e9e58a42a1a6ad38fc13da1968c9ee6a4b31 Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 10 Apr 2012 20:12:13 -0500 Subject: Collision/GameObjects: Corrected a possible logic fail Signed-off-by: Subv --- src/server/game/Entities/GameObject/GameObject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index bf1fc6ac706..d96c9052b7a 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -135,7 +135,7 @@ void GameObject::AddToWorld() sObjectAccessor->AddObject(this); bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); // The state can be changed after GameObject::Create but before GameObject::AddToWorld - bool toggledState = GetGoState() == GO_STATE_READY; + bool toggledState = GetGOData() ? GetGOData()->go_state == GO_STATE_READY : false; if (m_model) GetMap()->Insert(*m_model); if (startOpen ^ toggledState) -- cgit v1.2.3