From b6b59e77f5fe59c996f6688c19fb78ce29cdff72 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sun, 10 Dec 2023 17:27:18 -0600 Subject: [PATCH] [nostalgia/core/studio] Cleanup TileSheetEditor commands --- .../tilesheeteditor/commands/addsubsheetcommand.cpp | 4 ++-- .../tilesheeteditor/commands/cutpastecommand.cpp | 2 +- .../tilesheeteditor/commands/deletetilescommand.cpp | 2 +- .../studio/tilesheeteditor/commands/drawcommand.cpp | 10 +++++----- .../tilesheeteditor/commands/inserttilescommand.cpp | 2 +- .../commands/palettechangecommand.cpp | 8 ++++---- .../tilesheeteditor/commands/rmsubsheetcommand.cpp | 2 +- .../commands/updatesubsheetcommand.cpp | 12 ++++++------ 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/addsubsheetcommand.cpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/addsubsheetcommand.cpp index c5c1ec29..8a31bfb1 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/addsubsheetcommand.cpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/addsubsheetcommand.cpp @@ -11,7 +11,7 @@ AddSubSheetCommand::AddSubSheetCommand( TileSheet::SubSheetIdx parentIdx) noexcept: m_img(img), m_parentIdx(std::move(parentIdx)) { auto &parent = m_img.getSubSheet(m_parentIdx); - if (parent.subsheets.size()) { + if (!parent.subsheets.empty()) { auto idx = m_parentIdx; idx.emplace_back(parent.subsheets.size()); m_addedSheets.push_back(idx); @@ -56,7 +56,7 @@ int AddSubSheetCommand::commandId() const noexcept { return static_cast(CommandId::AddSubSheet); } -TileSheet::SubSheetIdx const &AddSubSheetCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const&AddSubSheetCommand::subsheetIdx() const noexcept { return m_parentIdx; } diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/cutpastecommand.cpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/cutpastecommand.cpp index 4adf02f4..c011c633 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/cutpastecommand.cpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/cutpastecommand.cpp @@ -59,7 +59,7 @@ int CutPasteCommand::commandId() const noexcept { return static_cast(m_commandId); } -TileSheet::SubSheetIdx const &CutPasteCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const&CutPasteCommand::subsheetIdx() const noexcept { return m_subSheetIdx; } diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/deletetilescommand.cpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/deletetilescommand.cpp index 313b0d89..c6787096 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/deletetilescommand.cpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/deletetilescommand.cpp @@ -54,7 +54,7 @@ int DeleteTilesCommand::commandId() const noexcept { return static_cast(CommandId::DeleteTile); } -TileSheet::SubSheetIdx const &DeleteTilesCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const&DeleteTilesCommand::subsheetIdx() const noexcept { return m_idx; } diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/drawcommand.cpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/drawcommand.cpp index 0becb669..99e9964f 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/drawcommand.cpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/drawcommand.cpp @@ -12,10 +12,10 @@ DrawCommand::DrawCommand( std::size_t idx, int palIdx) noexcept: m_img(img), - m_subSheetIdx(std::move(subSheetIdx)) { + m_subSheetIdx(std::move(subSheetIdx)), + m_palIdx(palIdx) { auto &subsheet = m_img.getSubSheet(m_subSheetIdx); m_changes.emplace_back(static_cast(idx), subsheet.getPixel(m_img.bpp, idx)); - m_palIdx = palIdx; } DrawCommand::DrawCommand( @@ -24,12 +24,12 @@ DrawCommand::DrawCommand( const ox::Vector &idxList, int palIdx) noexcept: m_img(img), - m_subSheetIdx(std::move(subSheetIdx)) { + m_subSheetIdx(std::move(subSheetIdx)), + m_palIdx(palIdx) { auto &subsheet = m_img.getSubSheet(m_subSheetIdx); for (const auto idx : idxList) { m_changes.emplace_back(static_cast(idx), subsheet.getPixel(m_img.bpp, idx)); } - m_palIdx = palIdx; } bool DrawCommand::append(std::size_t idx) noexcept { @@ -74,7 +74,7 @@ int DrawCommand::commandId() const noexcept { return static_cast(CommandId::Draw); } -TileSheet::SubSheetIdx const &DrawCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const&DrawCommand::subsheetIdx() const noexcept { return m_subSheetIdx; } diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/inserttilescommand.cpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/inserttilescommand.cpp index 95065ac4..52b23807 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/inserttilescommand.cpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/inserttilescommand.cpp @@ -54,7 +54,7 @@ int InsertTilesCommand::commandId() const noexcept { return static_cast(CommandId::InsertTile); } -TileSheet::SubSheetIdx const &InsertTilesCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const&InsertTilesCommand::subsheetIdx() const noexcept { return m_idx; } diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.cpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.cpp index 193bde36..4318b1f6 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.cpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/palettechangecommand.cpp @@ -11,9 +11,9 @@ core::PaletteChangeCommand::PaletteChangeCommand( TileSheet &img, ox::CRStringView newPalette) noexcept: m_img(img), - m_idx(std::move(idx)) { - m_oldPalette = m_img.defaultPalette; - m_newPalette = ox::FileAddress(ox::sfmt>("uuid://{}", newPalette)); + m_idx(std::move(idx)), + m_oldPalette(m_img.defaultPalette), + m_newPalette(ox::FileAddress(ox::sfmt>("uuid://{}", newPalette))) { } void PaletteChangeCommand::redo() noexcept { @@ -28,7 +28,7 @@ int PaletteChangeCommand::commandId() const noexcept { return static_cast(CommandId::PaletteChange); } -TileSheet::SubSheetIdx const &PaletteChangeCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const&PaletteChangeCommand::subsheetIdx() const noexcept { return m_idx; } 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 fae3c897..ac7a9c38 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp @@ -30,7 +30,7 @@ int RmSubSheetCommand::commandId() const noexcept { return static_cast(CommandId::RmSubSheet); } -TileSheet::SubSheetIdx const &RmSubSheetCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const&RmSubSheetCommand::subsheetIdx() const noexcept { return m_idx; } diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp index 740979de..5c16579f 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp @@ -13,11 +13,11 @@ core::UpdateSubSheetCommand::UpdateSubSheetCommand( int cols, int rows) noexcept: m_img(img), - m_idx(std::move(idx)) { - m_sheet = m_img.getSubSheet(m_idx); - m_newName = std::move(name); - m_newCols = cols; - m_newRows = rows; + m_idx(std::move(idx)), + m_sheet(m_img.getSubSheet(m_idx)), + m_newName(std::move(name)), + m_newCols(cols), + m_newRows(rows) { } void UpdateSubSheetCommand::redo() noexcept { @@ -37,7 +37,7 @@ int UpdateSubSheetCommand::commandId() const noexcept { return static_cast(CommandId::UpdateSubSheet); } -TileSheet::SubSheetIdx const &UpdateSubSheetCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const&UpdateSubSheetCommand::subsheetIdx() const noexcept { return m_idx; }