From 9650ba678bad77bc3b401e71b209cbf4dd5debb2 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 16 May 2011 13:24:08 +0200 Subject: Core/Scripts: Implemented DOOR_TYPE_SPAWN_HOLE to use in instance script DoorData, marking doors that are only open if encounter is in progress, typically used with spawning points --- src/server/game/Instances/InstanceScript.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'src/server/game/Instances/InstanceScript.cpp') diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index e468e29c70c..2281caf4e74 100755 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -111,28 +111,25 @@ void InstanceScript::UpdateDoorState(GameObject *door) return; bool open = true; - for (DoorInfoMap::iterator itr = lower; itr != upper; ++itr) + for (DoorInfoMap::iterator itr = lower; itr != upper && open; ++itr) { - if (itr->second.type == DOOR_TYPE_ROOM) + switch (itr->second.type) { - if (itr->second.bossInfo->state == IN_PROGRESS) - { - open = false; + case DOOR_TYPE_ROOM: + open = (itr->second.bossInfo->state != IN_PROGRESS); break; - } - } - else if (itr->second.type == DOOR_TYPE_PASSAGE) - { - if (itr->second.bossInfo->state != DONE) - { - open = false; + case DOOR_TYPE_PASSAGE: + open = (itr->second.bossInfo->state == DONE); + break; + case DOOR_TYPE_SPAWN_HOLE: + open = (itr->second.bossInfo->state == IN_PROGRESS); + break; + default: break; - } } } door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY); - //sLog->outError("Door %u is %s.", door->GetEntry(), open ? "opened" : "closed"); } void InstanceScript::AddDoor(GameObject *door, bool add) -- cgit v1.2.3