Missing function added back (#62)

Utf8ToUpperOnlyLatin was missing from Util.h and Util.cpp. This function
is only executed for the CATA core.

This was resulting in build errors under Windows and Visual Studio.

Code taken from Trinitycore, as that was the only version I could find.
Thank you, Trinitycore :-)
This commit is contained in:
Charles A Edwards 2016-07-25 11:32:30 +01:00 committed by Antz
parent 9392814797
commit 31459a6243
3 changed files with 20 additions and 0 deletions

View file

@ -8,6 +8,7 @@
#define GLOBALMETHODS_H #define GLOBALMETHODS_H
#include "ElunaBinding.h" #include "ElunaBinding.h"
#include "Util.h"
/*** /***
* These functions can be used anywhere at any time, including at start-up. * These functions can be used anywhere at any time, including at start-up.

View file

@ -375,6 +375,17 @@ void utf8truncate(std::string& utf8str, size_t len)
} }
} }
bool Utf8ToUpperOnlyLatin(std::string& utf8String)
{
std::wstring wstr;
if (!Utf8toWStr(utf8String, wstr))
return false;
std::transform(wstr.begin(), wstr.end(), wstr.begin(), wcharToUpperOnlyLatin);
return WStrToUtf8(wstr, utf8String);
}
bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize) bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize)
{ {
try try

View file

@ -252,6 +252,14 @@ inline void ApplyPercentModFloatVar(float& var, float val, bool apply)
var *= (apply ? (100.0f + val) / 100.0f : 100.0f / (100.0f + val)); var *= (apply ? (100.0f + val) / 100.0f : 100.0f / (100.0f + val));
} }
/**
* @brief
*
* @param utf8String
* @return bool
*/
bool Utf8ToUpperOnlyLatin(std::string& utf8String);
/** /**
* @brief * @brief
* *