From c90152b425957431b756306e8f3957bbf03eadcf Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 9 Mar 2023 00:36:18 -0500 Subject: [PATCH] GUI: fix adding orders --- src/engine/engine.cpp | 3 ++- src/gui/doAction.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 8efde4e39..2dcd8c9b9 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -3625,7 +3625,8 @@ void DivEngine::addOrder(int pos, bool duplicate, bool where) { } curSubSong->ordersLen++; saveLock.unlock(); - if (pos<=curOrder) curOrder++; + curOrder=pos+1; + prevOrder=curOrder; if (playing && !freelance) { playSub(false); } diff --git a/src/gui/doAction.cpp b/src/gui/doAction.cpp index 82fe5d15c..89057e43b 100644 --- a/src/gui/doAction.cpp +++ b/src/gui/doAction.cpp @@ -1472,6 +1472,7 @@ void FurnaceGUI::doAction(int what) { case GUI_ACTION_ORDERS_ADD: prepareUndo(GUI_UNDO_CHANGE_ORDER); e->addOrder(curOrder,false,false); + curOrder=e->getOrder(); makeUndo(GUI_UNDO_CHANGE_ORDER); break; case GUI_ACTION_ORDERS_DUPLICATE: