DEADSOFTWARE

do not forbid selecting invalid saves; report "you idiot" instead
authorKetmar Dark <ketmar@ketmar.no-ip.org>
Sun, 17 Sep 2017 07:46:41 +0000 (10:46 +0300)
committerKetmar Dark <ketmar@ketmar.no-ip.org>
Sun, 17 Sep 2017 07:47:13 +0000 (10:47 +0300)
src/game/g_language.pas
src/game/g_menu.pas
src/game/g_saveload.pas

index 7b74c3bbb9b2236886f58ec5aa96e93ae7897f18..01efd55df8cd8deb9effe213d5936268edfcbae3 100644 (file)
@@ -587,6 +587,8 @@ type
     I_MSG_UNBAN_OK,
     I_MSG_UNBAN_FAIL,
 
+    I_MSG_BAD_SAVE_VERSION,
+
     I_TEXTURE_ENDPIC,
 
     I_VERSION,
@@ -1701,6 +1703,9 @@ const
     ('MSG UNBAN FAIL',                 'Client %s not found in the ban list.',
                                        'Êëèåíò %s íå ÷èñëèòñÿ â ñïèñêå çàáàíåíûõ.'),
 
+    ('MSG BAD SAVE VERSION',           'Cannot load saved game. Probably due to invalid save file version.',
+                                       'Íå óäàëîñü çàãðóçèòü ñîõðàíåíèå. Ñêîðåå âåñåãî -- èç-çà íåâåðíîé âåðñèè ñîõðàíåíèÿ.'),
+
     ('TEXTURE ENDPIC',                 'ENDGAME_EN',
                                        'ENDGAME_RU'),
 
index 04f7331c5a00394ea29382d57da64604c4b7dbb4..05e32bf9d016ca27fca3883e4c2569a6f26d00d6 100644 (file)
@@ -1106,7 +1106,7 @@ begin
   begin
     TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a))).Text := g_GetSaveName(a, valid);
     TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a))).Invalid := not valid;
-    TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
+    //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
   end;
 end;
 
@@ -1145,9 +1145,15 @@ begin
   if g_Game_IsNet then Exit;
   a := StrToInt(Copy(Sender.Name, Length(Sender.Name), 1));
   if g_LoadGame(a) then
+  begin
     g_Game_PauseAllSounds(False)
+  end
   else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
+  begin
+    g_Console_Add(_lc[I_MSG_BAD_SAVE_VERSION], true);
     g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
+    //g_ActiveWindow := nil;
+  end;
 end;
 
 procedure ProcSingle1Player();
index ad438f89174172171fa0d05b6b174cc982c5cd20..19bac6828f29869994a7e8e30e649846434d0878 100644 (file)
@@ -507,7 +507,7 @@ begin
         e_WriteLog('LoadState Error: '+e.message, TMsgType.Warning);
         {$IF DEFINED(D2F_DEBUG)}e_LogWritefln('stream error position: 0x%08x', [errpos], TMsgType.Warning);{$ENDIF}
         gLoadGameMode := false;
-        result := true;
+        result := false;
         if not gameCleared then g_Game_Free();
         {$IF DEFINED(D2F_DEBUG)}e_WriteStackTrace(e.message);{$ENDIF}
       end;