Ivan Savenko 2 سال پیش
والد
کامیت
b61c9a9e35

+ 1 - 1
client/CPlayerInterface.cpp

@@ -183,7 +183,7 @@ void CPlayerInterface::playerStartsTurn(PlayerColor player)
 
 	// close window from another player
 	if(auto w = GH.windows().topWindow<CInfoWindow>())
-		if(w->ID == -1 && player != playerID)
+		if(w->ID == QueryID::NONE && player != playerID)
 			w->close();
 	
 	// remove all dialogs that do not expect query answer

+ 26 - 35
lib/CBonusTypeHandler.cpp

@@ -101,62 +101,53 @@ std::string CBonusTypeHandler::bonusToGraphics(const std::shared_ptr<Bonus> & bo
 	}
 	case BonusType::SPELL_DAMAGE_REDUCTION: //Spell damage reduction for all schools
 	{
-		switch(bonus->subtype)
-		{
-		case SpellSchool(ESpellSchool::ANY):
+		if (bonus->subtype == SpellSchool::ANY.getNum())
 			fileName = "E_GOLEM.bmp";
-			break;	
-		case SpellSchool(ESpellSchool::AIR):
+
+		if (bonus->subtype == SpellSchool::AIR.getNum())
 			fileName = "E_LIGHT.bmp";
-			break;
-		case SpellSchool(ESpellSchool::FIRE):
+
+		if (bonus->subtype == SpellSchool::FIRE.getNum())
 			fileName = "E_FIRE.bmp";
-			break;
-		case SpellSchool(ESpellSchool::WATER):
+
+		if (bonus->subtype == SpellSchool::WATER.getNum())
 			fileName = "E_COLD.bmp";
-			break;
-		case SpellSchool(ESpellSchool::EARTH):
+
+		if (bonus->subtype == SpellSchool::EARTH.getNum())
 			fileName = "E_SPEATH1.bmp"; //No separate icon for earth damage
-			break;
-		}
+
 		break;
 	}
 	case BonusType::SPELL_SCHOOL_IMMUNITY: //for all school
 	{
-		switch(bonus->subtype)
-		{
-		case SpellSchool(ESpellSchool::AIR):
+		if (bonus->subtype == SpellSchool::AIR.getNum())
 			fileName = "E_SPAIR.bmp";
-			break;
-		case SpellSchool(ESpellSchool::FIRE):
+
+		if (bonus->subtype == SpellSchool::FIRE.getNum())
 			fileName = "E_SPFIRE.bmp";
-			break;
-		case SpellSchool(ESpellSchool::WATER):
+
+		if (bonus->subtype == SpellSchool::WATER.getNum())
 			fileName = "E_SPWATER.bmp";
-			break;
-		case SpellSchool(ESpellSchool::EARTH):
+
+		if (bonus->subtype == SpellSchool::EARTH.getNum())
 			fileName = "E_SPEATH.bmp";
-			break;
-		}
+
 		break;
 	}
 	case BonusType::NEGATIVE_EFFECTS_IMMUNITY:
 	{
-		switch(bonus->subtype)
-		{
-		case SpellSchool(ESpellSchool::AIR):
+		if (bonus->subtype == SpellSchool::AIR.getNum())
 			fileName = "E_SPAIR1.bmp";
-			break;
-		case SpellSchool(ESpellSchool::FIRE):
+
+		if (bonus->subtype == SpellSchool::FIRE.getNum())
 			fileName = "E_SPFIRE1.bmp";
-			break;
-		case SpellSchool(ESpellSchool::WATER):
+
+		if (bonus->subtype == SpellSchool::WATER.getNum())
 			fileName = "E_SPWATER1.bmp";
-			break;
-		case SpellSchool(ESpellSchool::EARTH):
+
+		if (bonus->subtype == SpellSchool::EARTH.getNum())
 			fileName = "E_SPEATH1.bmp";
-			break;
-		}
+
 		break;
 	}
 	case BonusType::LEVEL_SPELL_IMMUNITY:

+ 0 - 2
lib/constants/EntityIdentifiers.h

@@ -914,6 +914,4 @@ using River = RiverId;
 using Road = RoadId;
 using ETerrainId = TerrainId;
 
-
-
 VCMI_LIB_NAMESPACE_END

+ 2 - 0
lib/constants/Enumerations.h

@@ -9,6 +9,8 @@
  */
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 enum class PrimarySkill : int8_t
 {
 	NONE = -1,

+ 0 - 1
lib/constants/StringConstants.h

@@ -213,5 +213,4 @@ namespace MappedKeys
 	};
 }
 
-
 VCMI_LIB_NAMESPACE_END

+ 3 - 3
scripting/lua/LuaStack.h

@@ -26,13 +26,13 @@ namespace detail
 	template<typename T>
 	struct IsRegularClass
 	{
-		static constexpr auto value = std::is_class<T>::value && !std::is_base_of<IdTag, T>::value;
+		static constexpr auto value = std::is_class<T>::value && !std::is_base_of<IdentifierBase, T>::value;
 	};
 
 	template<typename T>
 	struct IsIdClass
 	{
-		static constexpr auto value = std::is_class<T>::value && std::is_base_of<IdTag, T>::value;
+		static constexpr auto value = std::is_class<T>::value && std::is_base_of<IdentifierBase, T>::value;
 	};
 }
 
@@ -78,7 +78,7 @@ public:
 	template<typename T, typename std::enable_if< detail::IsIdClass<T>::value, int>::type = 0>
 	void push(const T & value)
 	{
-		pushInteger(static_cast<lua_Integer>(value.toEnum()));
+		pushInteger(static_cast<lua_Integer>(value.getNum()));
 	}
 
 	template<typename T, typename std::enable_if<detail::IsRegularClass<T>::value, int>::type = 0>