diff options
author | megamage <none@none> | 2009-05-16 16:52:45 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-05-16 16:52:45 -0500 |
commit | a0ba5dc20608c5f415f05bbd52480944909b4ad2 (patch) | |
tree | 840fb49cb5ef4f8169f783963c58353423e6ff32 /src | |
parent | a5df3c9e72191d732554eed860790859363bebf4 (diff) |
*Allow creating new instance when log in and a save exists.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/MapInstanced.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
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; |