master
niczkx 12 years ago committed by Eduardo Bart
parent b7ac6ce6d5
commit 02f89dd8be

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

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

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

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

Loading…
Cancel
Save