1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Rename parameter and remove extra check

This commit is contained in:
nordsoft 2023-05-01 04:07:31 +04:00 committed by Nordsoft91
parent 07b2052679
commit 87ff31531f
4 changed files with 7 additions and 8 deletions

View File

@ -191,7 +191,7 @@ void CGMarket::onHeroVisit(const CGHeroInstance * h) const
int CGMarket::getMarketEfficiency() const
{
return marketEfficacy;
return marketEfficiency;
}
bool CGMarket::allowsTrade(EMarketMode::EMarketMode mode) const

View File

@ -35,7 +35,7 @@ class DLL_LINKAGE CGMarket : public CGObjectInstance, public IMarket
public:
std::set<EMarketMode::EMarketMode> marketModes;
int marketEfficacy = 5;
int marketEfficiency;
//window variables
std::string title;
@ -56,7 +56,7 @@ public:
{
h & static_cast<CGObjectInstance&>(*this);
h & marketModes;
h & marketEfficacy;
h & marketEfficiency;
h & title;
h & speech;
}

View File

@ -299,7 +299,7 @@ void MarketInstanceConstructor::initTypeData(const JsonNode & input)
marketModes.insert(MappedKeys::MARKET_NAMES_TO_TYPES.at(element.String()));
}
marketEfficacy = input["efficacy"].isNull() ? -1 : input["efficacy"].Integer();
marketEfficiency = input["efficiency"].isNull() ? 5 : input["efficiency"].Integer();
predefinedOffer = input["offer"];
title = input["title"].String();
@ -332,8 +332,7 @@ CGObjectInstance * MarketInstanceConstructor::create(std::shared_ptr<const Objec
if(tmpl)
market->appearance = tmpl;
market->marketModes = marketModes;
if(marketEfficacy >= 0)
market->marketEfficacy = marketEfficacy;
market->marketEfficiency = marketEfficiency;
market->title = market->getObjectName();
if(!title.empty())

View File

@ -262,7 +262,7 @@ protected:
std::set<EMarketMode::EMarketMode> marketModes;
JsonNode predefinedOffer;
int marketEfficacy;
int marketEfficiency;
std::string title, speech;
@ -274,7 +274,7 @@ public:
{
h & static_cast<CDefaultObjectTypeHandler<CGMarket>&>(*this);
h & marketModes;
h & marketEfficacy;
h & marketEfficiency;
}
};