1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Event message meta string

This commit is contained in:
nordsoft 2023-09-27 23:28:17 +02:00
parent f9f79255c5
commit 00c8c2eb82
4 changed files with 7 additions and 6 deletions

View File

@ -59,7 +59,7 @@ bool CMapEvent::earlierThanOrEqual(const CMapEvent & other) const
void CMapEvent::serializeJson(JsonSerializeFormat & handler)
{
handler.serializeString("name", name);
handler.serializeString("message", message);
handler.serializeStruct("message", message);
handler.serializeInt("players", players);
handler.serializeInt("humanAffected", humanAffected);
handler.serializeInt("computerAffected", computerAffected);

View File

@ -13,6 +13,7 @@
VCMI_LIB_NAMESPACE_BEGIN
#include "../ResourceSet.h"
#include "../MetaString.h"
class TerrainType;
class RiverType;
@ -33,7 +34,7 @@ public:
bool earlierThanOrEqual(const CMapEvent & other) const;
std::string name;
std::string message;
MetaString message;
TResources resources;
ui8 players; // affected players, bit field?
ui8 humanAffected;

View File

@ -2155,7 +2155,7 @@ CGObjectInstance * CMapLoaderH3M::readTown(const int3 & position, std::shared_pt
{
CCastleEvent event;
event.name = readBasicString();
event.message = readLocalizedString(TextIdentifier("town", position.x, position.y, position.z, "event", eventID, "description"));
event.message.appendTextID(readLocalizedString(TextIdentifier("town", position.x, position.y, position.z, "event", eventID, "description")));
reader->readResourses(event.resources);
@ -2225,7 +2225,7 @@ void CMapLoaderH3M::readEvents()
{
CMapEvent event;
event.name = readBasicString();
event.message = readLocalizedString(TextIdentifier("event", eventID, "description"));
event.message.appendTextID(readLocalizedString(TextIdentifier("event", eventID, "description")));
reader->readResourses(event.resources);
event.players = reader->readUInt8();

View File

@ -3216,7 +3216,7 @@ void CGameHandler::handleTimeEvents()
//prepare dialog
InfoWindow iw;
iw.player = color;
iw.text.appendRawString(ev.message);
iw.text = ev.message;
for (int i=0; i<ev.resources.size(); i++)
{
@ -3267,7 +3267,7 @@ void CGameHandler::handleTownEvents(CGTownInstance * town, NewTurn &n)
// dialog
InfoWindow iw;
iw.player = player;
iw.text.appendRawString(ev.message);
iw.text = ev.message;
if (ev.resources.nonZero())
{