mirror of
https://github.com/edubart/otclient.git
synced 2025-12-02 16:06:51 +01:00
Fix NPC/Monster rendering for OTBM
This commit is contained in:
@@ -167,7 +167,7 @@ void ResourceManager::loadFile(const std::string& fileName, std::iostream& out)
|
||||
std::ifstream fin(fileName);
|
||||
if(!fin) {
|
||||
out.clear(std::ios::failbit);
|
||||
stdext::throw_exception(stdext::format("unable to file '%s': %s", fileName.c_str(), PHYSFS_getLastError()));
|
||||
stdext::throw_exception(stdext::format("unable to load file '%s': %s", fileName.c_str(), PHYSFS_getLastError()));
|
||||
} else {
|
||||
out << fin.rdbuf();
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "string.h"
|
||||
#include "format.h"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <ctype.h>
|
||||
|
||||
namespace stdext {
|
||||
|
||||
@@ -113,6 +114,31 @@ void trim(std::string& str)
|
||||
boost::trim(str);
|
||||
}
|
||||
|
||||
char upchar(char c)
|
||||
{
|
||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||
return ::toupper(c); // use the one from global scope "ctype.h"
|
||||
#else
|
||||
if((c >= 97 && c <= 122) || (c <= -1 && c >= -32))
|
||||
c -= 32;
|
||||
|
||||
return c;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ucwords(std::string& str)
|
||||
{
|
||||
uint32 strLen = str.length();
|
||||
if(strLen == 0)
|
||||
return;
|
||||
|
||||
str[0] = upchar(str[0]);
|
||||
for(uint32 i = 1; i < strLen; ++i) {
|
||||
if(str[i - 1] == ' ')
|
||||
str[i] = upchar(str[i]);
|
||||
}
|
||||
}
|
||||
|
||||
bool ends_with(const std::string& str, const std::string& test)
|
||||
{
|
||||
return boost::ends_with(str, test);
|
||||
|
||||
@@ -46,6 +46,8 @@ std::string utf8_to_latin1(uchar *utf8);
|
||||
void tolower(std::string& str);
|
||||
void toupper(std::string& str);
|
||||
void trim(std::string& str);
|
||||
void ucwords(std::string& str);
|
||||
char upchar(char c);
|
||||
bool ends_with(const std::string& str, const std::string& test);
|
||||
bool starts_with(const std::string& str, const std::string& test);
|
||||
void replace_all(std::string& str, const std::string& search, const std::string& replacement);
|
||||
|
||||
@@ -970,14 +970,6 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
Point readPoint() const
|
||||
{
|
||||
Point ret;
|
||||
ret.x = readType<int>("x");
|
||||
ret.y = readType<int>("y");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** Template form of the attribute query which will try to read the
|
||||
attribute into the specified type. Very easy, very powerful, but
|
||||
be careful to make sure to call this with the correct type.
|
||||
|
||||
Reference in New Issue
Block a user