Commit 18123aca authored by Chen Bill's avatar Chen Bill

DataManager: fix FormatType

parent eb9f6cb1
...@@ -330,22 +330,19 @@ std::wstring DataManager::FormatRace(unsigned int race) const { ...@@ -330,22 +330,19 @@ std::wstring DataManager::FormatRace(unsigned int race) const {
buffer.pop_back(); buffer.pop_back();
return buffer; return buffer;
} }
const wchar_t* DataManager::FormatType(int type) { std::wstring DataManager::FormatType(unsigned int type) const {
wchar_t* p = tpBuffer; std::wstring buffer;
unsigned filter = 1;
int i = 1050; int i = 1050;
for(; filter != 0x8000000; filter <<= 1, ++i) { for (unsigned filter = TYPE_MONSTER; filter <= TYPE_LINK; filter <<= 1, ++i) {
if(type & filter) { if (type & filter) {
BufferIO::CopyWStrRef(GetSysString(i), p, 16); buffer.append(GetSysString(i));
*p = L'|'; buffer.push_back(L'|');
*++p = 0;
} }
} }
if(p != tpBuffer) if (buffer.empty())
*(p - 1) = 0; return std::wstring(unknown_string);
else buffer.pop_back();
return unknown_string; return buffer;
return tpBuffer;
} }
const wchar_t* DataManager::FormatSetName(const uint16_t setcode[]) { const wchar_t* DataManager::FormatSetName(const uint16_t setcode[]) {
wchar_t* p = scBuffer; wchar_t* p = scBuffer;
......
...@@ -35,7 +35,7 @@ public: ...@@ -35,7 +35,7 @@ public:
const wchar_t* FormatLocation(int location, int sequence) const; const wchar_t* FormatLocation(int location, int sequence) const;
std::wstring FormatAttribute(unsigned int attribute) const; std::wstring FormatAttribute(unsigned int attribute) const;
std::wstring FormatRace(unsigned int race) const; std::wstring FormatRace(unsigned int race) const;
const wchar_t* FormatType(int type); std::wstring FormatType(unsigned int type) const;
const wchar_t* FormatSetName(const uint16_t setcode[]); const wchar_t* FormatSetName(const uint16_t setcode[]);
const wchar_t* FormatLinkMarker(int link_marker); const wchar_t* FormatLinkMarker(int link_marker);
...@@ -50,7 +50,6 @@ public: ...@@ -50,7 +50,6 @@ public:
wchar_t numStrings[301][4]{}; wchar_t numStrings[301][4]{};
wchar_t numBuffer[6]{}; wchar_t numBuffer[6]{};
wchar_t tpBuffer[128]{};
wchar_t scBuffer[128]{}; wchar_t scBuffer[128]{};
wchar_t lmBuffer[32]{}; wchar_t lmBuffer[32]{};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment