소스 검색

Do not write mods that do not affect gameplay to saved games

Ivan Savenko 1 년 전
부모
커밋
6af2609e0f
2개의 변경된 파일9개의 추가작업 그리고 4개의 파일을 삭제
  1. 7 2
      lib/modding/ActiveModsInSaveList.cpp
  2. 2 2
      lib/modding/ActiveModsInSaveList.h

+ 7 - 2
lib/modding/ActiveModsInSaveList.cpp

@@ -17,9 +17,14 @@
 
 VCMI_LIB_NAMESPACE_BEGIN
 
-std::vector<TModID> ActiveModsInSaveList::getActiveMods()
+std::vector<TModID> ActiveModsInSaveList::getActiveGameplayAffectingMods()
 {
-	return VLC->modh->getActiveMods();
+	std::vector<TModID> result;
+	for (auto const & entry : VLC->modh->getActiveMods())
+		if (VLC->modh->getModInfo(entry).checkModGameplayAffecting())
+			result.push_back(entry);
+
+	return result;
 }
 
 const ModVerificationInfo & ActiveModsInSaveList::getVerificationInfo(TModID mod)

+ 2 - 2
lib/modding/ActiveModsInSaveList.h

@@ -16,7 +16,7 @@ VCMI_LIB_NAMESPACE_BEGIN
 
 class ActiveModsInSaveList
 {
-	std::vector<TModID> getActiveMods();
+	std::vector<TModID> getActiveGameplayAffectingMods();
 	const ModVerificationInfo & getVerificationInfo(TModID mod);
 
 	/// Checks whether provided mod list is compatible with current VLC and throws on failure
@@ -26,7 +26,7 @@ public:
 	{
 		if(h.saving)
 		{
-			std::vector<TModID> activeMods = getActiveMods();
+			std::vector<TModID> activeMods = getActiveGameplayAffectingMods();
 			h & activeMods;
 			for(const auto & m : activeMods)
 				h & getVerificationInfo(m);