aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSubv <s.v.h21@hotmail.com>2012-03-17 14:34:01 -0500
committerSubv <s.v.h21@hotmail.com>2012-03-17 15:58:47 -0500
commit21ccfb8e2e12945315dc3eba64c02d7ac5cd61e7 (patch)
tree01d303509f5428e801648d16b9823d18047078f5 /src
parent41cc704bf86dc1832a18cdd7ecd387fbb9137775 (diff)
Collision/GameObjects: Fixed LoS for all doors (open and closed). Looks like data0 for type 0 is in fact startClosed instead of startOpen
closes #5660 Signed-off-by: Subv <s.v.h21@hotmail.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 2e8e68cf8b2..1cd8fa17183 100755
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -134,7 +134,8 @@ void GameObject::AddToWorld()
sObjectAccessor->AddObject(this);
bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
- bool toggledState = (GetGOData() ? GetGOData()->go_state == GO_STATE_ACTIVE : false);
+ // The state can be changed after GameObject::Create but before GameObject::AddToWorld
+ bool toggledState = GetGoState() == GO_STATE_READY;
if (m_model)
GetMap()->Insert(*m_model);
if ((startOpen && !toggledState) || (!startOpen && toggledState))
@@ -1904,7 +1905,8 @@ void GameObject::SetLootState(LootState state, Unit* unit)
// startOpen determines whether we are going to add or remove the LoS on activation
bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
- if (GetGOData() && GetGOData()->go_state == GO_NOT_READY)
+ // Use the current go state
+ if (GetGoState() == GO_STATE_ACTIVE)
startOpen = !startOpen;
if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)
@@ -1925,7 +1927,7 @@ void GameObject::SetGoState(GOState state)
// startOpen determines whether we are going to add or remove the LoS on activation
bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
- if (GetGOData() && GetGOData()->go_state == GO_NOT_READY)
+ if (GetGOData() && GetGOData()->go_state == GO_STATE_READY)
startOpen = !startOpen;
if (state == GO_STATE_ACTIVE || state == GO_STATE_ACTIVE_ALTERNATIVE)