diff options
author | n0n4m3 <none@none> | 2009-12-17 06:49:36 +0100 |
---|---|---|
committer | n0n4m3 <none@none> | 2009-12-17 06:49:36 +0100 |
commit | 365f0ae5626f86e5a8b38b45cb2a9bdb95d6d7ad (patch) | |
tree | 03b7e236a73e6b8b4cb617861b602e7e2ed3f058 /src/game/Map.cpp | |
parent | 3e03b0aa2d7b369d7e12a9bcee81e421735c4dac (diff) |
Replace some assert with return statement, fixed some crash bugs
--HG--
branch : trunk
Diffstat (limited to 'src/game/Map.cpp')
-rw-r--r-- | src/game/Map.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 64e7e8dd4e6..53702235f7a 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -683,11 +683,20 @@ void Map::RemoveUnitFromNotify(Unit *unit) else if(slot < i_unitsToNotify.size() && i_unitsToNotify[slot] == unit) i_unitsToNotify[slot] = NULL; else - assert(false); + { + sLog.outError("Map::RemoveUnitFromNotify(Unit*) unit has incorrect notify slot=%d, cleaning up",slot); + unit->m_NotifyListPos = -1; + return; + } } else { - assert(slot < i_unitsToNotify.size()); + if(slot >= i_unitsToNotify.size()) + { + sLog.outError("Map::RemoveUnitFromNotify(Unit*) unit has incorrect notify slot=%d, cleaning up", slot); + unit->m_NotifyListPos = -1; + return; + } i_unitsToNotify[slot] = NULL; } @@ -2584,7 +2593,7 @@ bool InstanceMap::Add(Player *player) if(playerBind->save != mapSave) { sLog.outError("InstanceMap::Add: player %s(%d) is permanently bound to instance %d,%d,%d,%d,%d,%d but he is being put in instance %d,%d,%d,%d,%d,%d", player->GetName(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset()); - assert(false); + return false; } } else @@ -2618,7 +2627,7 @@ bool InstanceMap::Add(Player *player) sLog.outError("GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount()); else sLog.outError("GroupBind save NULL"); - assert(false); + return false; } // if the group/leader is permanently bound to the instance // players also become permanently bound when they enter |