Browse Source

Rename parameter and remove extra check

nordsoft 2 years ago
parent
commit
87ff31531f

+ 1 - 1
lib/mapObjects/CGMarket.cpp

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

+ 2 - 2
lib/mapObjects/CGMarket.h

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

+ 2 - 3
lib/mapObjects/CommonConstructors.cpp

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

+ 2 - 2
lib/mapObjects/CommonConstructors.h

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