[nostalgia/core/studio] Remove some unnecessary copying

This commit is contained in:
Gary Talent 2024-05-22 23:19:01 -05:00
parent 4a2b1fd743
commit aa83c2a62b

View File

@ -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 {