From aa83c2a62b169b5a272a51288bb2b44daa0c78e3 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 22 May 2024 23:19:01 -0500 Subject: [PATCH] [nostalgia/core/studio] Remove some unnecessary copying --- .../studio/tilesheeteditor/commands/rmsubsheetcommand.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp index a0c0a8ce..fccfc71c 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp @@ -11,19 +11,18 @@ core::RmSubSheetCommand::RmSubSheetCommand(TileSheet &img, TileSheet::SubSheetId m_idx(std::move(idx)), m_parentIdx(m_idx) { m_parentIdx.pop_back(); - auto &parent = getSubSheet(m_img, m_parentIdx); - m_sheet = parent.subsheets[*m_idx.back().value]; } void RmSubSheetCommand::redo() noexcept { auto &parent = getSubSheet(m_img, m_parentIdx); + m_sheet = std::move(parent.subsheets[*m_idx.back().value]); oxLogError(parent.subsheets.erase(*m_idx.back().value).error); } void RmSubSheetCommand::undo() noexcept { auto &parent = getSubSheet(m_img, m_parentIdx); - auto i = *m_idx.back().value; - parent.subsheets.insert(i, m_sheet); + auto const i = *m_idx.back().value; + parent.subsheets.insert(i, std::move(m_sheet)); } int RmSubSheetCommand::commandId() const noexcept {