Ver Fonte

Fix save compatiblity with 1.4

Ivan Savenko há 1 ano atrás
pai
commit
7790acae3a
1 ficheiros alterados com 6 adições e 1 exclusões
  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;