From 02f89dd8bea23d7bf3e5860cc3e52fd71ed39d0c Mon Sep 17 00:00:00 2001 From: niczkx Date: Tue, 17 Jul 2012 21:31:55 +0200 Subject: [PATCH] fixes --- src/framework/core/resourcemanager.cpp | 2 +- src/framework/stdext/string.h | 11 ++--------- src/otclient/map.cpp | 9 +++++++-- src/otclient/map.h | 2 +- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/framework/core/resourcemanager.cpp b/src/framework/core/resourcemanager.cpp index 5b5249be..e94610fa 100644 --- a/src/framework/core/resourcemanager.cpp +++ b/src/framework/core/resourcemanager.cpp @@ -93,7 +93,7 @@ bool ResourceManager::setWriteDir(const std::string& writeDir, bool create) m_writeDir = writeDir; if(!addSearchPath(writeDir)) - g_logger.error(stdext::format("Unable to add write directory '%s' to search path")); + g_logger.error(stdext::format("Unable to add write '%s' directory to search path", writeDir)); return true; } diff --git a/src/framework/stdext/string.h b/src/framework/stdext/string.h index 649ccf9e..5e467bca 100644 --- a/src/framework/stdext/string.h +++ b/src/framework/stdext/string.h @@ -29,7 +29,6 @@ #include #include #include -#include #include #include "types.h" @@ -215,16 +214,10 @@ inline std::string utf8StringToLatin1(uchar *utf8) { } // Convert string to lower case -inline std::string toLowerCaseString(std::string& str) { - std::transform(str.begin(), str.end(), str.begin(), tolower); - return str; -} +inline std::string tolower(std::string& str) { return boost::algorithm::to_lower_copy(str); } // Convert string to upper case -inline std::string toUpperCaseString(std::string& str) { - std::transform(str.begin(), str.end(), str.begin(), toupper); - return str; -} +inline std::string toupper(std::string& str) { return boost::algorithm::to_upper_copy(str); } // utility for printing messages into stdout template diff --git a/src/otclient/map.cpp b/src/otclient/map.cpp index 59f7a122..a623cdb5 100644 --- a/src/otclient/map.cpp +++ b/src/otclient/map.cpp @@ -388,11 +388,11 @@ void Map::loadSpawns(const std::string &fileName) TiXmlElement* root = doc.FirstChildElement(); if(!root || root->ValueStr() != "spawns") - stdext::throw_exception(stdext::format("malformed spawns file")); + stdext::throw_exception("malformed spawns file"); for(TiXmlElement* node = root->FirstChildElement(); node; node = node->NextSiblingElement()) { if (node->ValueTStr() != "spawn") - stdext::throw_exception(stdext::format("invalid spawn node")); + stdext::throw_exception("invalid spawn node"); Position centerPos(cast("x", uint16, node), cast("y", uint16, node), cast("z", uint8, node)); for(TiXmlElement* mType = node->FirstChildElement(); mType; mType = mType->NextSiblingElement()) { @@ -1029,3 +1029,8 @@ std::tuple, Otc::PathFindResult> Map::findPath(const return ret; } + +MonsterPtr Map::getMonster(const std::string& name) +{ + return m_monsters.getMonster(stdext::tolower(name)); +} diff --git a/src/otclient/map.h b/src/otclient/map.h index 44b5ba30..3b4c80e1 100644 --- a/src/otclient/map.h +++ b/src/otclient/map.h @@ -151,7 +151,7 @@ public: // town/house/monster related TownPtr getTown(uint32 tid) { return m_towns.getTown(tid); } HousePtr getHouse(uint32 hid) { return m_houses.getHouse(hid); } - MonsterPtr getMonster(const std::string& name) { return m_monsters.getMonster(name); } + MonsterPtr getMonster(const std::string& name); void setLight(const Light& light) { m_light = light; } void setCentralPosition(const Position& centralPosition);