mirror of
https://github.com/vcmi/vcmi.git
synced 2025-10-08 23:22:25 +02:00
texts for mine
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
#include "../mapping/TerrainTile.h"
|
#include "../mapping/TerrainTile.h"
|
||||||
#include "../modding/IdentifierStorage.h"
|
#include "../modding/IdentifierStorage.h"
|
||||||
#include "../texts/TextIdentifier.h"
|
#include "../texts/TextIdentifier.h"
|
||||||
|
#include "../texts/CGeneralTextHandler.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
@@ -99,6 +100,12 @@ void MineInstanceConstructor::initTypeData(const JsonNode & input)
|
|||||||
{
|
{
|
||||||
resourceType = GameResID(index);
|
resourceType = GameResID(index);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!config["name"].isNull())
|
||||||
|
LIBRARY->generaltexth->registerString(config.getModScope(), getNameTextID(), config["name"]);
|
||||||
|
|
||||||
|
if (!config["description"].isNull())
|
||||||
|
LIBRARY->generaltexth->registerString(config.getModScope(), getDescriptionTextID(), config["description"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameResID MineInstanceConstructor::getResourceType() const
|
GameResID MineInstanceConstructor::getResourceType() const
|
||||||
@@ -106,6 +113,16 @@ GameResID MineInstanceConstructor::getResourceType() const
|
|||||||
return resourceType;
|
return resourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string MineInstanceConstructor::getDescriptionTextID() const
|
||||||
|
{
|
||||||
|
return TextIdentifier(getBaseTextID(), "description").get();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string MineInstanceConstructor::getDescriptionTranslated() const
|
||||||
|
{
|
||||||
|
return LIBRARY->generaltexth->translate(getDescriptionTextID());
|
||||||
|
}
|
||||||
|
|
||||||
void CTownInstanceConstructor::initTypeData(const JsonNode & input)
|
void CTownInstanceConstructor::initTypeData(const JsonNode & input)
|
||||||
{
|
{
|
||||||
LIBRARY->identifiers()->requestIdentifier("faction", input["faction"], [&](si32 index)
|
LIBRARY->identifiers()->requestIdentifier("faction", input["faction"], [&](si32 index)
|
||||||
|
@@ -70,6 +70,8 @@ public:
|
|||||||
void initTypeData(const JsonNode & input) override;
|
void initTypeData(const JsonNode & input) override;
|
||||||
|
|
||||||
GameResID getResourceType() const;
|
GameResID getResourceType() const;
|
||||||
|
std::string getDescriptionTextID() const;
|
||||||
|
std::string getDescriptionTranslated() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CTownInstanceConstructor : public CDefaultObjectTypeHandler<CGTownInstance>
|
class CTownInstanceConstructor : public CDefaultObjectTypeHandler<CGTownInstance>
|
||||||
|
@@ -171,7 +171,7 @@ std::string CGMine::getObjectName() const
|
|||||||
if(getResourceHandler()->getResourceType() == GameResID::NONE || getObjTypeIndex() < GameConstants::RESOURCE_QUANTITY)
|
if(getResourceHandler()->getResourceType() == GameResID::NONE || getObjTypeIndex() < GameConstants::RESOURCE_QUANTITY)
|
||||||
return LIBRARY->generaltexth->translate("core.minename", getObjTypeIndex());
|
return LIBRARY->generaltexth->translate("core.minename", getObjTypeIndex());
|
||||||
else
|
else
|
||||||
return getResourceHandler()->getResourceType().toResource()->getNameTranslated() + " " + LIBRARY->generaltexth->translate("core.genrltxt.617"); // TODO: new strings for new mines
|
return getResourceHandler()->getNameTranslated();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CGMine::getHoverText(PlayerColor player) const
|
std::string CGMine::getHoverText(PlayerColor player) const
|
||||||
@@ -201,7 +201,7 @@ void CGMine::flagMine(IGameEventCallback & gameEvents, const PlayerColor & playe
|
|||||||
if(getResourceHandler()->getResourceType() == GameResID::NONE || getObjTypeIndex() < GameConstants::RESOURCE_QUANTITY)
|
if(getResourceHandler()->getResourceType() == GameResID::NONE || getObjTypeIndex() < GameConstants::RESOURCE_QUANTITY)
|
||||||
iw.text.appendTextID(TextIdentifier("core.mineevnt", producedResource.getNum()).get()); //not use subID, abandoned mines uses default mine texts
|
iw.text.appendTextID(TextIdentifier("core.mineevnt", producedResource.getNum()).get()); //not use subID, abandoned mines uses default mine texts
|
||||||
else
|
else
|
||||||
iw.text.appendRawString(getObjectName()); // TODO: new strings for new mines
|
iw.text.appendRawString(getResourceHandler()->getDescriptionTranslated());
|
||||||
iw.player = player;
|
iw.player = player;
|
||||||
iw.components.emplace_back(ComponentType::RESOURCE_PER_DAY, producedResource, getProducedQuantity());
|
iw.components.emplace_back(ComponentType::RESOURCE_PER_DAY, producedResource, getProducedQuantity());
|
||||||
gameEvents.showInfoDialog(&iw);
|
gameEvents.showInfoDialog(&iw);
|
||||||
|
Reference in New Issue
Block a user