From a0ba5dc20608c5f415f05bbd52480944909b4ad2 Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 16 May 2009 16:52:45 -0500 Subject: *Allow creating new instance when log in and a save exists. --HG-- branch : trunk --- src/game/MapInstanced.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp index 137c325ff88..0ac64b8f62e 100644 --- a/src/game/MapInstanced.cpp +++ b/src/game/MapInstanced.cpp @@ -145,15 +145,26 @@ Map* MapInstanced::GetInstance(const WorldObject* obj) pSave = groupBind->save; } - if(instanceId && pSave && instanceId != pSave->GetInstanceId()) - return NULL; - - if(!player->GetSession()->PlayerLoading()) // enter a new map + if(pSave) { - if(pSave) - return CreateInstance(pSave->GetInstanceId(), pSave, pSave->GetDifficulty()); - else - return CreateInstance(MapManager::Instance().GenerateInstanceId(), NULL, player->GetDifficulty()); + if(!instanceId) + { + instanceId = pSave->GetInstanceId(); // go from outside to instance + if(Map *map = _FindMap(instanceId)) + return map; + } + else if(instanceId != pSave->GetInstanceId()) // cannot go from one instance to another + return NULL; + // else log in at a saved instance + + return CreateInstance(instanceId, pSave, pSave->GetDifficulty()); + } + else if(!player->GetSession()->PlayerLoading()) + { + if(!instanceId) + instanceId = MapManager::Instance().GenerateInstanceId(); + + return CreateInstance(instanceId, NULL, player->GetDifficulty()); } return NULL; -- cgit v1.2.3