This commit is contained in:
niczkx 2012-07-17 21:31:55 +02:00 committed by Eduardo Bart
parent b7ac6ce6d5
commit 02f89dd8be
4 changed files with 11 additions and 13 deletions

View File

@ -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;
}

View File

@ -29,7 +29,6 @@
#include <sstream>
#include <iomanip>
#include <vector>
#include <cctype>
#include <boost/algorithm/string.hpp>
#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<class... T>

View File

@ -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<std::vector<Otc::Direction>, Otc::PathFindResult> Map::findPath(const
return ret;
}
MonsterPtr Map::getMonster(const std::string& name)
{
return m_monsters.getMonster(stdext::tolower(name));
}

View File

@ -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);