From c8c226903e99aea13032c2a321809dd360dddac1 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Mon, 22 May 2023 20:34:45 +0300 Subject: [PATCH] fix file opening from command line --- src/editor/Editor.lpr | 8 ++------ src/editor/f_main.pas | 8 ++++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/editor/Editor.lpr b/src/editor/Editor.lpr index b96ed23..171c856 100644 --- a/src/editor/Editor.lpr +++ b/src/editor/Editor.lpr @@ -120,15 +120,11 @@ uses end; procedure CheckParamFiles; - var i: Integer; path: AnsiString; + var i: Integer; begin i := ParamFileIndex; if i <= ParamCount then - begin - path := ParamStr(i); - if path <> '' then - OpenMap(path, ''); - end; + StartMap := ParamStr(i); end; procedure InitLogs; diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas index ca323f6..8d11a3b 100644 --- a/src/editor/f_main.pas +++ b/src/editor/f_main.pas @@ -288,6 +288,7 @@ const var MainForm: TMainForm; + StartMap: String; OpenedMap: String; OpenedWAD: String; @@ -6530,6 +6531,7 @@ begin end; procedure TMainForm.OnIdle(Sender: TObject; var Done: Boolean); + var f: AnsiString; begin // FIXME: this is a shitty hack if not gDataLoaded then @@ -6545,6 +6547,12 @@ begin MainForm.FormResize(nil); end; Draw(); + if StartMap <> '' then + begin + f := StartMap; + StartMap := ''; + OpenMap(f, ''); + end; end; procedure TMainForm.miMapPreviewClick(Sender: TObject); -- 2.11.4.GIT