diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-10-22 13:09:25 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-10-22 13:16:30 +0200 |
commit | bf6e38872829f87ff408f294184da14c8c24bfd4 (patch) | |
tree | f569a61013932b0988e90e83dbc553e93457639a /src/game-server/mapmanager.cpp | |
parent | 05130de24bf68d6ca427cbc126a03159ca777e5d (diff) | |
download | manaserv-bf6e38872829f87ff408f294184da14c8c24bfd4.tar.gz manaserv-bf6e38872829f87ff408f294184da14c8c24bfd4.tar.xz manaserv-bf6e38872829f87ff408f294184da14c8c24bfd4.zip |
Made the servers check for positive id in xml db loading.
Also fixed a memleak when loading an invalid monster attack.
Resolves: Mana-Mantis #215.
Reviewed-by: Thorbjorn.
Diffstat (limited to 'src/game-server/mapmanager.cpp')
-rw-r--r-- | src/game-server/mapmanager.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/game-server/mapmanager.cpp b/src/game-server/mapmanager.cpp index bee4358..ab9b2dc 100644 --- a/src/game-server/mapmanager.cpp +++ b/src/game-server/mapmanager.cpp @@ -70,7 +70,7 @@ int MapManager::initialize(const std::string &mapReferenceFile) std::string name = XML::getProperty(node, "name", std::string()); // Test id and map name - if (id != 0 && !name.empty()) + if (id > 0 && !name.empty()) { // Testing if the file is actually in the maps folder std::string file = std::string("maps/") + name + ".tmx"; @@ -89,6 +89,18 @@ int MapManager::initialize(const std::string &mapReferenceFile) ++loadedMaps; } } + else + { + if (name.empty()) + { + LOG_WARN("Invalid unnamed map Id: " << id << '.'); + } + else + { + LOG_WARN("Invalid map Id: " << id << " for map: " + << name << '.'); + } + } } if (loadedMaps > 0) |