summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6f61137)
raw | patch | inline | side by side (parent: 6f61137)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Wed, 7 Aug 2019 21:43:23 +0000 (00:43 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Wed, 7 Aug 2019 21:43:29 +0000 (00:43 +0300) |
src/game/g_saveload.pas | patch | blob | history | |
src/shared/utils.pas | patch | blob | history |
index 194b8337a06813310aacb4a7b39a808fbdc8da02..17a186698a26ed0c5cccb2ce8d4f336c4bbb1fd2 100644 (file)
--- a/src/game/g_saveload.pas
+++ b/src/game/g_saveload.pas
st.Free();
end;
except
+ on e: EFileNotFoundException do
+ begin
+ g_Console_Add(_lc[I_GAME_ERROR_LOAD]);
+ g_Console_Add('LoadState Error: '+e.message);
+ e_WriteLog('LoadState Error: '+e.message, TMsgType.Warning);
+ gLoadGameMode := false;
+ result := false;
+ end;
on e: Exception do
begin
g_Console_Add(_lc[I_GAME_ERROR_LOAD]);
+ g_Console_Add('LoadState Error: '+e.message);
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 := false;
- if not gameCleared then g_Game_Free();
+ if gState <> STATE_MENU then
+ g_FatalError(_lc[I_GAME_ERROR_LOAD])
+ else if not gameCleared then
+ g_Game_Free();
{$IF DEFINED(D2F_DEBUG)}e_WriteStackTrace(e.message);{$ENDIF}
end;
end;
diff --git a/src/shared/utils.pas b/src/shared/utils.pas
index 21172272a8a01ca64132494ddeed01fb63b0d27c..e62cc1c3fccd98571e3e6680a0216e093c452e86 100644 (file)
--- a/src/shared/utils.pas
+++ b/src/shared/utils.pas
function openDiskFileRO (pathname: AnsiString): TStream;
begin
- if not findFileCI(pathname) then raise Exception.Create('can''t open file "'+pathname+'"');
+ if not findFileCI(pathname) then raise EFileNotFoundException.Create('can''t open file "'+pathname+'"');
result := TFileStream.Create(pathname, fmOpenRead or {fmShareDenyWrite}fmShareDenyNone);
end;