Pārlūkot izejas kodu

Fix 3184

Taken from !684. This fixes a bug with primary skills that results in
heroes not being able to interact with objects, or skills being
incorrect when moving from mission to mission.
Agoston Szepessy 3 gadi atpakaļ
vecāks
revīzija
5080f26235
1 mainītis faili ar 9 papildinājumiem un 0 dzēšanām
  1. 9 0
      lib/mapObjects/CGHeroInstance.cpp

+ 9 - 0
lib/mapObjects/CGHeroInstance.cpp

@@ -1431,6 +1431,15 @@ void CGHeroInstance::serializeCommonOptions(JsonSerializeFormat & handler)
 {
 {
 	handler.serializeString("biography", biography);
 	handler.serializeString("biography", biography);
 	handler.serializeInt("experience", exp, 0);
 	handler.serializeInt("experience", exp, 0);
+
+	if (!handler.saving)
+	{
+		while (gainsLevel())
+		{
+			++level;
+		}
+	}
+
 	handler.serializeString("name", name);
 	handler.serializeString("name", name);
 	handler.serializeBool<ui8>("female", sex, 1, 0, 0xFF);
 	handler.serializeBool<ui8>("female", sex, 1, 0, 0xFF);