[nostalgia/core/studio] Remove some unnecessary copying
This commit is contained in:
parent
4a2b1fd743
commit
aa83c2a62b
@ -11,19 +11,18 @@ core::RmSubSheetCommand::RmSubSheetCommand(TileSheet &img, TileSheet::SubSheetId
|
|||||||
m_idx(std::move(idx)),
|
m_idx(std::move(idx)),
|
||||||
m_parentIdx(m_idx) {
|
m_parentIdx(m_idx) {
|
||||||
m_parentIdx.pop_back();
|
m_parentIdx.pop_back();
|
||||||
auto &parent = getSubSheet(m_img, m_parentIdx);
|
|
||||||
m_sheet = parent.subsheets[*m_idx.back().value];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RmSubSheetCommand::redo() noexcept {
|
void RmSubSheetCommand::redo() noexcept {
|
||||||
auto &parent = getSubSheet(m_img, m_parentIdx);
|
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);
|
oxLogError(parent.subsheets.erase(*m_idx.back().value).error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RmSubSheetCommand::undo() noexcept {
|
void RmSubSheetCommand::undo() noexcept {
|
||||||
auto &parent = getSubSheet(m_img, m_parentIdx);
|
auto &parent = getSubSheet(m_img, m_parentIdx);
|
||||||
auto i = *m_idx.back().value;
|
auto const i = *m_idx.back().value;
|
||||||
parent.subsheets.insert(i, m_sheet);
|
parent.subsheets.insert(i, std::move(m_sheet));
|
||||||
}
|
}
|
||||||
|
|
||||||
int RmSubSheetCommand::commandId() const noexcept {
|
int RmSubSheetCommand::commandId() const noexcept {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user