mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Add description for University using H3 string
This commit is contained in:
@@ -124,6 +124,7 @@
|
||||
"rarity" : 20
|
||||
},
|
||||
"modes" : ["resource-skill"],
|
||||
"description" : "@core.xtrainfo.24",
|
||||
"speech" : "@core.genrltxt.603",
|
||||
"offer":
|
||||
[
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "../texts/CGeneralTextHandler.h"
|
||||
#include "../texts/TextIdentifier.h"
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
void MarketInstanceConstructor::initTypeData(const JsonNode & input)
|
||||
{
|
||||
if (settings["mods"]["validation"].String() != "off")
|
||||
@@ -26,8 +28,15 @@ void MarketInstanceConstructor::initTypeData(const JsonNode & input)
|
||||
if (!input["description"].isNull())
|
||||
{
|
||||
std::string description = input["description"].String();
|
||||
descriptionTextID = TextIdentifier(getBaseTextID(), "description").get();
|
||||
LIBRARY->generaltexth->registerString( input.getModScope(), descriptionTextID, input["description"]);
|
||||
if (!description.empty() && description.at(0) == '@')
|
||||
{
|
||||
descriptionTextID = description.substr(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
descriptionTextID = TextIdentifier(getBaseTextID(), "description").get();
|
||||
LIBRARY->generaltexth->registerString( input.getModScope(), descriptionTextID, input["description"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!input["speech"].isNull())
|
||||
@@ -59,6 +68,11 @@ bool MarketInstanceConstructor::hasDescription() const
|
||||
return !descriptionTextID.empty();
|
||||
}
|
||||
|
||||
std::string MarketInstanceConstructor::getDescriptionTextID() const
|
||||
{
|
||||
return descriptionTextID;
|
||||
}
|
||||
|
||||
std::shared_ptr<CGMarket> MarketInstanceConstructor::createObject(IGameInfoCallback * cb) const
|
||||
{
|
||||
if(marketModes.size() == 1)
|
||||
@@ -103,3 +117,5 @@ int MarketInstanceConstructor::getMarketEfficiency() const
|
||||
{
|
||||
return marketEfficiency;
|
||||
}
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
|
||||
const std::set<EMarketMode> & availableModes() const;
|
||||
bool hasDescription() const;
|
||||
std::string getDescriptionTextID() const;
|
||||
|
||||
std::string getSpeechTranslated() const;
|
||||
int getMarketEfficiency() const;
|
||||
|
||||
@@ -51,7 +51,7 @@ std::string CGMarket::getPopupText(PlayerColor player) const
|
||||
|
||||
MetaString message = MetaString::createFromRawString("{%s}\r\n\r\n%s");
|
||||
message.replaceName(ID, subID);
|
||||
message.replaceTextID(TextIdentifier(getObjectHandler()->getBaseTextID(), "description").get());
|
||||
message.replaceTextID(getMarketHandler()->getDescriptionTextID());
|
||||
return message.toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user