1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

Fix build

This commit is contained in:
Ivan Savenko 2023-06-19 00:25:21 +03:00
parent d4728f78ce
commit 9b5e81929f
5 changed files with 15 additions and 8 deletions

View File

@ -300,6 +300,11 @@ void MetaString::replaceCreatureName(const CStackBasicDescriptor & stack)
replaceCreatureName(stack.type->getId(), stack.count); replaceCreatureName(stack.type->getId(), stack.count);
} }
bool MetaString::operator == (const MetaString & other) const
{
return message == other.message && localStrings == other.localStrings && exactStrings == other.exactStrings && stringsTextID == other.stringsTextID && numbers == other.numbers;
}
void MetaString::jsonSerialize(JsonNode & dest) const void MetaString::jsonSerialize(JsonNode & dest) const
{ {
JsonNode jsonMessage; JsonNode jsonMessage;

View File

@ -109,6 +109,8 @@ public:
/// Returns true if current string is empty /// Returns true if current string is empty
bool empty() const; bool empty() const;
bool operator == (const MetaString & other) const;
void jsonSerialize(JsonNode & dest) const; void jsonSerialize(JsonNode & dest) const;
void jsonDeserialize(const JsonNode & dest); void jsonDeserialize(const JsonNode & dest);

View File

@ -47,7 +47,7 @@ int BattleLogMessageProxy::addText(lua_State * L)
{ {
if(object->lines.empty()) if(object->lines.empty())
object->lines.emplace_back(); object->lines.emplace_back();
object->lines.back() << text; object->lines.back().appendRawString(text);
} }
} }

View File

@ -56,17 +56,17 @@ int InfoWindowProxy::addReplacement(lua_State * L)
const auto *raw = lua_tolstring(L, 2, &len); const auto *raw = lua_tolstring(L, 2, &len);
std::string text(raw, len); std::string text(raw, len);
object->text.addReplacement(text); object->text.replaceRawString(text);
} }
else if(lua_isnumber(L, 2)) else if(lua_isnumber(L, 2))
{ {
object->text.addReplacement(lua_tointeger(L, 2)); object->text.replaceNumber(lua_tointeger(L, 2));
} }
} }
else if(top >= 3) else if(top >= 3)
{ {
if(lua_isnumber(L, 2) && lua_isnumber(L, 3)) if(lua_isnumber(L, 2) && lua_isnumber(L, 3))
object->text.addReplacement(lua_tointeger(L, 2), lua_tointeger(L, 3)); object->text.replaceLocalString(static_cast<EMetaText>(lua_tointeger(L, 2)), lua_tointeger(L, 3));
} }
return S.retVoid(); return S.retVoid();
@ -90,18 +90,18 @@ int InfoWindowProxy::addText(lua_State * L)
const auto *raw = lua_tolstring(L, 2, &len); const auto *raw = lua_tolstring(L, 2, &len);
std::string text(raw, len); std::string text(raw, len);
object->text << text; object->text.appendRawString(text);
} }
else if(lua_isnumber(L, 2)) else if(lua_isnumber(L, 2))
{ {
object->text << (lua_tointeger(L, 2)); object->text.appendNumber(lua_tointeger(L, 2));
} }
} }
if(top >= 3) if(top >= 3)
{ {
if(lua_isnumber(L, 2) && lua_isnumber(L, 3)) if(lua_isnumber(L, 2) && lua_isnumber(L, 3))
object->text.addTxt(lua_tointeger(L, 2), lua_tointeger(L, 3)); object->text.appendLocalString(static_cast<EMetaText>(lua_tointeger(L, 2)), lua_tointeger(L, 3));
} }
return S.retVoid(); return S.retVoid();

View File

@ -12,7 +12,7 @@
#include <vcmi/spells/Magic.h> #include <vcmi/spells/Magic.h>
#include "../../lib/NetPacksBase.h" #include "../../lib/MetaString.h"
namespace spells namespace spells
{ {