From: Ketmar Dark Date: Sun, 17 Sep 2017 07:46:41 +0000 (+0300) Subject: do not forbid selecting invalid saves; report "you idiot" instead X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=d12a083b9f6755e96a3884d54b0d4487b3c19c07;p=d2df-sdl.git do not forbid selecting invalid saves; report "you idiot" instead --- diff --git a/src/game/g_language.pas b/src/game/g_language.pas index 7b74c3b..01efd55 100644 --- a/src/game/g_language.pas +++ b/src/game/g_language.pas @@ -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'), diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas index 04f7331..05e32bf 100644 --- a/src/game/g_menu.pas +++ b/src/game/g_menu.pas @@ -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(); diff --git a/src/game/g_saveload.pas b/src/game/g_saveload.pas index ad438f8..19bac68 100644 --- a/src/game/g_saveload.pas +++ b/src/game/g_saveload.pas @@ -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;