Browse Source

Creature message meta string

nordsoft 2 years ago
parent
commit
f9f79255c5
3 changed files with 5 additions and 4 deletions
  1. 2 2
      lib/mapObjects/CGCreature.cpp
  2. 2 1
      lib/mapObjects/CGCreature.h
  3. 1 1
      lib/mapping/MapFormatH3M.cpp

+ 2 - 2
lib/mapObjects/CGCreature.cpp

@@ -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

+ 2 - 1
lib/mapObjects/CGCreature.h

@@ -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

+ 1 - 1
lib/mapping/MapFormatH3M.cpp

@@ -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();
 	}