1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Win/loss condition texts use MetaString

This commit is contained in:
Ivan Savenko
2023-06-18 13:51:11 +03:00
parent 56d69e790b
commit d51fe62804
16 changed files with 230 additions and 180 deletions

View File

@@ -423,10 +423,10 @@ void CMapFormatJson::serializeHeader(JsonSerializeFormat & handler)
handler.serializeLIC("allowedHeroes", &HeroTypeID::decode, &HeroTypeID::encode, VLC->heroh->getDefaultAllowed(), mapHeader->allowedHeroes);
handler.serializeString("victoryString", mapHeader->victoryMessage);
// handler.serializeString("victoryString", mapHeader->victoryMessage);
handler.serializeInt("victoryIconIndex", mapHeader->victoryIconIndex);
handler.serializeString("defeatString", mapHeader->defeatMessage);
// handler.serializeString("defeatString", mapHeader->defeatMessage);
handler.serializeInt("defeatIconIndex", mapHeader->defeatIconIndex);
}
@@ -683,10 +683,10 @@ void CMapFormatJson::readTriggeredEvent(TriggeredEvent & event, const JsonNode &
{
using namespace TriggeredEventsDetail;
event.onFulfill = source["message"].String();
event.description = source["description"].String();
// event.onFulfill = source["message"].String();
// event.description = source["description"].String();
event.effect.type = vstd::find_pos(typeNames, source["effect"]["type"].String());
event.effect.toOtherMessage = source["effect"]["messageToSend"].String();
// event.effect.toOtherMessage = source["effect"]["messageToSend"].String();
event.trigger = EventExpression(source["condition"], JsonToCondition); // logical expression
}
@@ -704,16 +704,16 @@ void CMapFormatJson::writeTriggeredEvent(const TriggeredEvent & event, JsonNode
{
using namespace TriggeredEventsDetail;
if(!event.onFulfill.empty())
dest["message"].String() = event.onFulfill;
// if(!event.onFulfill.empty())
// dest["message"].String() = event.onFulfill;
if(!event.description.empty())
dest["description"].String() = event.description;
// if(!event.description.empty())
// dest["description"].String() = event.description;
dest["effect"]["type"].String() = typeNames.at(static_cast<size_t>(event.effect.type));
if(!event.effect.toOtherMessage.empty())
dest["effect"]["messageToSend"].String() = event.effect.toOtherMessage;
// if(!event.effect.toOtherMessage.empty())
// dest["effect"]["messageToSend"].String() = event.effect.toOtherMessage;
dest["condition"] = event.trigger.toJson(ConditionToJson);
}