Browse Source

Fix error: 'auto' not allowed in non-static struct member

Alexander Wilms 1 year ago
parent
commit
7a1cee1a60
3 changed files with 6 additions and 6 deletions
  1. 1 1
      client/windows/GUIClasses.cpp
  2. 2 2
      lib/JsonNode.cpp
  3. 3 3
      lib/bonuses/BonusParams.h

+ 1 - 1
client/windows/GUIClasses.cpp

@@ -785,7 +785,7 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
 
 		auto moveArmy = [this](const bool leftToRight) -> void
 		{
-			auto slotId = std::nullopt;
+			std::optional<SlotID> slotId = std::nullopt;
 			if(auto slot = getSelectedSlotID())
 				slotId = slot->getSlot();
 			controller.moveArmy(leftToRight, slotId);

+ 2 - 2
lib/JsonNode.cpp

@@ -1204,8 +1204,8 @@ CSelector JsonUtils::parseSelector(const JsonNode & ability)
 		ret = ret.And(Selector::subtype()(subtype));
 	}
 	value = &ability["sourceType"];
-	auto src = std::nullopt; //Fixes for GCC false maybe-uninitialized
-	auto id = std::nullopt;
+	std::optional<BonusSource> src = std::nullopt; //Fixes for GCC false maybe-uninitialized
+	std::optional<BonusSourceID> id = std::nullopt;
 	if(value->isString())
 	{
 		auto it = bonusSourceMap.find(value->String());

+ 3 - 3
lib/bonuses/BonusParams.h

@@ -19,10 +19,10 @@ VCMI_LIB_NAMESPACE_BEGIN
 struct DLL_LINKAGE BonusParams {
 	bool isConverted;
 	BonusType type = BonusType::NONE;
-	auto subtype = std::nullopt;
-	auto valueType = std::nullopt;
+	std::optional<BonusSubtypeID> subtype = std::nullopt;
+	std::optional<BonusValueType> valueType = std::nullopt;
 	std::optional<si32> val = std::nullopt;
-	auto targetType = std::nullopt;
+	std::optional<BonusSource> targetType = std::nullopt;
 
 	BonusParams(bool isConverted = true) : isConverted(isConverted) {};
 	BonusParams(std::string deprecatedTypeStr, std::string deprecatedSubtypeStr = "", int deprecatedSubtype = 0);