From: DeaDDooMER Date: Mon, 22 May 2023 17:34:45 +0000 (+0300) Subject: fix file opening from command line X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=c8c226903e99aea13032c2a321809dd360dddac1;p=d2df-editor.git fix file opening from command line --- 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);