summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cde380b)
raw | patch | inline | side by side (parent: cde380b)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Tue, 12 Sep 2017 21:16:55 +0000 (00:16 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Tue, 12 Sep 2017 21:17:05 +0000 (00:17 +0300) |
src/game/g_gui.pas | patch | blob | history | |
src/game/g_menu.pas | patch | blob | history | |
src/game/g_saveload.pas | patch | blob | history |
diff --git a/src/game/g_gui.pas b/src/game/g_gui.pas
index 04b8d76a1cc6b79e6c508c3236005e2d2e5a1758..7367a82582f30617628f8e1adb5b748546f4318a 100644 (file)
--- a/src/game/g_gui.pas
+++ b/src/game/g_gui.pas
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 1af1a57336430d661b07faba3e378fb16d34bc2c..90527a15cbbab95279b76b8ec38ab38f8cb2a869 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
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;
index dec46f1ec720c21b68354583873296986d5f161a..dee199260879344aab173bd924a2a88af89631b7 100644 (file)
--- a/src/game/g_saveload.pas
+++ b/src/game/g_saveload.pas
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);
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;