From: Ketmar Dark Date: Tue, 12 Sep 2017 21:16:55 +0000 (+0300) Subject: save/load UI cosmetix X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=20114d602d19e4e913ea1a7c22f2031bd7f54677;p=d2df-sdl.git save/load UI cosmetix --- diff --git a/src/game/g_gui.pas b/src/game/g_gui.pas index 04b8d76..7367a82 100644 --- a/src/game/g_gui.pas +++ b/src/game/g_gui.pas @@ -2244,7 +2244,7 @@ begin r := FColor.R; g := FColor.G; b := FColor.B; - if FInvalid then begin r := 128; g := 128; b := 128; end; + if FInvalid and (FWindow.FActiveControl <> self) then begin r := 128; g := 128; b := 128; end; FFont.Draw(FX+8, FY, FText, r, g, b); if (FWindow.FActiveControl = self) then diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas index 1af1a57..90527a1 100644 --- a/src/game/g_menu.pas +++ b/src/game/g_menu.pas @@ -1114,11 +1114,13 @@ procedure ProcSaveMenu(); var a: Integer; valid: Boolean; + name: AnsiString; begin for a := 1 to 8 do begin - TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a))).Text := g_GetSaveName(a, valid); - TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a))).Invalid := not valid; + name := g_GetSaveName(a, valid); + TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a))).Text := name; + TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a))).Invalid := (name <> '') and (not valid); end; end; diff --git a/src/game/g_saveload.pas b/src/game/g_saveload.pas index dec46f1..dee1992 100644 --- a/src/game/g_saveload.pas +++ b/src/game/g_saveload.pas @@ -113,21 +113,33 @@ var st: TStream = nil; ver: Byte; stlen: Word; + filename: AnsiString; begin valid := false; result := ''; if (n < 0) or (n > 65535) then exit; try // Îòêðûâàåì ôàéë ñîõðàíåíèé - st := openDiskFileRO(buildSaveName(n)); + filename := buildSaveName(n); + st := openDiskFileRO(filename); try - if not utils.checkSign(st, 'DFSV') then raise XStreamError.Create('invalid save game signature'); + if not utils.checkSign(st, 'DFSV') then + begin + e_LogWritefln('GetSaveName: not a save file: ''%s''', [st], MSG_WARNING); + //raise XStreamError.Create('invalid save game signature'); + exit; + end; ver := utils.readByte(st); if (ver < 7) then begin utils.readLongWord(st); // section size stlen := utils.readWord(st); - if (stlen < 1) or (stlen > 64) then raise XStreamError.Create('invalid save game version'); + if (stlen < 1) or (stlen > 64) then + begin + e_LogWritefln('GetSaveName: not a save file: ''%s''', [st], MSG_WARNING); + //raise XStreamError.Create('invalid save game version'); + exit; + end; // Èìÿ ñýéâà SetLength(result, stlen); st.ReadBuffer(result[1], stlen); @@ -144,10 +156,9 @@ begin st.Free(); end; except - on e: Exception do begin - e_WriteLog('GetSaveName Error: '+e.message, MSG_WARNING); - {$IF DEFINED(D2F_DEBUG)}e_WriteStackTrace(e.message);{$ENDIF} + //e_WriteLog('GetSaveName Error: '+e.message, MSG_WARNING); + //{$IF DEFINED(D2F_DEBUG)}e_WriteStackTrace(e.message);{$ENDIF} result := ''; end; end;