From 6ae27224b0dcc860b882bebff3149828d874c832 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Thu, 12 Nov 2020 03:15:14 -0500 Subject: fixed a bunch of instance and command line stuff - clear instance manager overrides when restarting, or switching instances after starting MO with moshortcut://instance: won't do anything - clear overrides when the last selected instance can't be opened; MO would keep trying to open shortcuts even after selecting a different instance - command line was cleared too early, before the first run, so shortcuts were broken - the instance manager dialog can be opened without an instance loaded if the last selected instance doesn't exist, createNew() would throw because it tried to access the global Settings - fixed some problems with parts of MO wanting to restart and others expecting flow to continue - fixed create instance dialog using settings pointer to decide whether to restart; it restarts when it's the first created instance, which is not always the case even if the settings are null, so just check whether there are instances --- src/createinstancedialog.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/createinstancedialog.cpp') diff --git a/src/createinstancedialog.cpp b/src/createinstancedialog.cpp index 47cb9d5c..a4e3c336 100644 --- a/src/createinstancedialog.cpp +++ b/src/createinstancedialog.cpp @@ -131,7 +131,7 @@ CreateInstanceDialog::CreateInstanceDialog( ui->pages->setCurrentIndex(0); ui->launch->setChecked(true); - if (!m_settings) + if (!InstanceManager::singleton().hasAnyInstances()) { // first run of MO, there are no instances yet, force launch ui->launch->setEnabled(false); @@ -314,6 +314,10 @@ void CreateInstanceDialog::finish() }; + // don't restart if this is the first instance, it'll be selected and opened + const bool mustRestart = InstanceManager::singleton().hasAnyInstances(); + + try { std::vector> dirs; @@ -396,9 +400,7 @@ void CreateInstanceDialog::finish() if (ui->launch->isChecked()) { InstanceManager::singleton().setCurrentInstance(ci.instanceName); - if (m_settings) { - // don't restart without settings, it happens on startup when there are - // no instances + if (mustRestart) { ExitModOrganizer(Exit::Restart); m_switching = true; } -- cgit v1.3.1