Просмотр исходного кода

Fix save compatiblity with 1.4

Ivan Savenko 1 год назад
Родитель
Сommit
7790acae3a
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      lib/mapping/CMapHeader.h

+ 6 - 1
lib/mapping/CMapHeader.h

@@ -264,7 +264,12 @@ public:
 		h & width;
 		h & height;
 		h & twoLevel;
-		h & difficulty;
+		// FIXME: we should serialize enum's according to their underlying type
+		// should be fixed when we are making breaking change to save compatiblity
+		static_assert(Handler::Version::MINIMAL < Handler::Version::RELEASE_143);
+		uint8_t difficultyInteger = static_cast<uint8_t>(difficulty);
+		h & difficultyInteger;
+		difficulty = static_cast<EMapDifficulty>(difficultyInteger);
 		h & levelLimit;
 		h & areAnyPlayers;
 		h & players;