All pastes #917274 Raw Edit

Miscellany

public text v1 · immutable
#917274 ·published 2008-02-25 06:55 UTC
rendered paste body
Index: src/game/MapInstanced.cpp
===================================================================
--- src/game/MapInstanced.cpp	(revision 5293)
+++ src/game/MapInstanced.cpp	(working copy)
@@ -296,15 +296,15 @@
 
 void MapInstanced::CreateInstance(uint32 InstanceId, Map* &map)
 {
-    if (!IsValidInstance(InstanceId))
-    {
+ {
+	Guard guard(*this);
+	if (!IsValidInstance(InstanceId))
+	{
         // instance is invalid, need to verify map presence
         if (map)
         {
             // map for the instance is present, but the instance itself is no more valid, destroy map
-            Guard guard(*this);
-
-            map->Reset();
+		    map->Reset();
             m_InstancedMaps.erase(InstanceId);
             delete map;
             map = NULL;
@@ -320,6 +320,7 @@
         map = new Map(GetId(), GetGridExpiry(), InstanceId);
         m_InstancedMaps[InstanceId] = map;
     }
+ }
 }
 
 bool MapInstanced::IsValidInstance(uint32 InstanceId)