aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKandera <KanderaDev@gmail.com>2012-09-04 14:04:47 -0400
committerKandera <KanderaDev@gmail.com>2012-09-04 14:04:47 -0400
commit8afecc657293fd16922955d048a974efc95bf219 (patch)
tree36bb2fa41ccbb57a811b41383194bf8cb6aa54cb /src
parenta4c115a494135d2cda4abc99195bfbe238a06412 (diff)
Core/Gameobject: fix collision for gameobjects
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index e686e46c41d..6ef62519f40 100755
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -133,13 +133,13 @@ void GameObject::AddToWorld()
m_zoneScript->OnGameObjectCreate(this);
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 = GetGoType() == GAMEOBJECT_TYPE_CHEST ? getLootState () == GO_READY : GetGoState() != GO_STATE_READY;
+ bool toggledState = GetGoType() == GAMEOBJECT_TYPE_CHEST ? getLootState () == GO_READY : GetGoState() == GO_STATE_READY;
if (m_model)
GetMap()->InsertGameObjectModel(*m_model);
- EnableCollision(startOpen ^ toggledState);
+ EnableCollision(toggledState);
WorldObject::AddToWorld();
}
}
@@ -1926,14 +1926,12 @@ void GameObject::SetLootState(LootState state, Unit* unit)
sScriptMgr->OnGameObjectLootStateChanged(this, state, unit);
if (m_model)
{
- // 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);
-
+ bool collision = false;
// Use the current go state
if ((GetGoState() != GO_STATE_READY && (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)) || state == GO_READY)
- startOpen = !startOpen;
+ collision = !collision;
- EnableCollision(startOpen);
+ EnableCollision(collision);
}
}
@@ -1947,12 +1945,11 @@ void GameObject::SetGoState(GOState state)
return;
// 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 (state != GO_STATE_READY)
- startOpen = !startOpen;
+ bool collision = false;
+ if (state == GO_STATE_READY)
+ collision = !collision;
- EnableCollision(startOpen);
+ EnableCollision(collision);
}
}