mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
Implemented optional descriptions for market map objects
It is now possible to define description of an object with 'market' handler that will be shown on right-clicking the object. Similarly, added description to right-click popup to Hill Fort.
This commit is contained in:
@@ -205,6 +205,12 @@ AnimationPath BoatInstanceConstructor::getBoatAnimationName() const
|
||||
|
||||
void MarketInstanceConstructor::initTypeData(const JsonNode & input)
|
||||
{
|
||||
if (!input["description"].isNull())
|
||||
{
|
||||
description = input["description"].String();
|
||||
VLC->generaltexth->registerString(input.getModScope(), TextIdentifier(getBaseTextID(), "description"), description);
|
||||
}
|
||||
|
||||
for(auto & element : input["modes"].Vector())
|
||||
{
|
||||
if(MappedKeys::MARKET_NAMES_TO_TYPES.count(element.String()))
|
||||
@@ -218,6 +224,11 @@ void MarketInstanceConstructor::initTypeData(const JsonNode & input)
|
||||
speech = input["speech"].String();
|
||||
}
|
||||
|
||||
bool MarketInstanceConstructor::hasDescription() const
|
||||
{
|
||||
return !description.empty();
|
||||
}
|
||||
|
||||
CGMarket * MarketInstanceConstructor::createObject(IGameCallback * cb) const
|
||||
{
|
||||
if(marketModes.size() == 1)
|
||||
|
||||
@@ -118,6 +118,7 @@ protected:
|
||||
JsonNode predefinedOffer;
|
||||
int marketEfficiency;
|
||||
|
||||
std::string description;
|
||||
std::string title;
|
||||
std::string speech;
|
||||
|
||||
@@ -127,6 +128,7 @@ public:
|
||||
void randomizeObject(CGMarket * object, vstd::RNG & rng) const override;
|
||||
|
||||
const std::set<EMarketMode> & availableModes() const;
|
||||
bool hasDescription() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user