1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

Creature message meta string

This commit is contained in:
nordsoft 2023-09-27 23:25:19 +02:00
parent 0ac893b80f
commit f9f79255c5
3 changed files with 5 additions and 4 deletions

View File

@ -108,7 +108,7 @@ void CGCreature::onHeroVisit( const CGHeroInstance * h ) const
{
InfoWindow iw;
iw.player = h->tempOwner;
iw.text.appendRawString(message);
iw.text = message;
iw.type = EInfoWindowMode::MODAL;
cb->showInfoDialog(&iw);
}
@ -578,7 +578,7 @@ void CGCreature::serializeJsonOptions(JsonSerializeFormat & handler)
handler.serializeBool("noGrowing", notGrowingTeam);
handler.serializeBool("neverFlees", neverFlees);
handler.serializeString("rewardMessage", message);
handler.serializeStruct("rewardMessage", message);
}
VCMI_LIB_NAMESPACE_END

View File

@ -11,6 +11,7 @@
#include "CArmedInstance.h"
#include "../ResourceSet.h"
#include "../MetaString.h"
VCMI_LIB_NAMESPACE_BEGIN
@ -27,7 +28,7 @@ public:
ui32 identifier; //unique code for this monster (used in missions)
si8 character; //character of this set of creatures (0 - the most friendly, 4 - the most hostile) => on init changed to -4 (compliant) ... 10 value (savage)
std::string message; //message printed for attacking hero
MetaString message; //message printed for attacking hero
TResources resources; // resources given to hero that has won with monsters
ArtifactID gainedArtifact; //ID of artifact gained to hero, -1 if none
bool neverFlees; //if true, the troops will never flee

View File

@ -1099,7 +1099,7 @@ CGObjectInstance * CMapLoaderH3M::readMonster(const int3 & mapPosition, const Ob
bool hasMessage = reader->readBool();
if(hasMessage)
{
object->message = readLocalizedString(TextIdentifier("monster", mapPosition.x, mapPosition.y, mapPosition.z, "message"));
object->message.appendTextID(readLocalizedString(TextIdentifier("monster", mapPosition.x, mapPosition.y, mapPosition.z, "message")));
reader->readResourses(object->resources);
object->gainedArtifact = reader->readArtifact();
}