[nostalgia/core/studio] Cleanup TileSheetEditor commands
This commit is contained in:
parent
4a94672fdc
commit
b6b59e77f5
@ -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<int>(CommandId::AddSubSheet);
|
||||
}
|
||||
|
||||
TileSheet::SubSheetIdx const &AddSubSheetCommand::subsheetIdx() const noexcept {
|
||||
TileSheet::SubSheetIdx const&AddSubSheetCommand::subsheetIdx() const noexcept {
|
||||
return m_parentIdx;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ int CutPasteCommand::commandId() const noexcept {
|
||||
return static_cast<int>(m_commandId);
|
||||
}
|
||||
|
||||
TileSheet::SubSheetIdx const &CutPasteCommand::subsheetIdx() const noexcept {
|
||||
TileSheet::SubSheetIdx const&CutPasteCommand::subsheetIdx() const noexcept {
|
||||
return m_subSheetIdx;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ int DeleteTilesCommand::commandId() const noexcept {
|
||||
return static_cast<int>(CommandId::DeleteTile);
|
||||
}
|
||||
|
||||
TileSheet::SubSheetIdx const &DeleteTilesCommand::subsheetIdx() const noexcept {
|
||||
TileSheet::SubSheetIdx const&DeleteTilesCommand::subsheetIdx() const noexcept {
|
||||
return m_idx;
|
||||
}
|
||||
|
||||
|
@ -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<uint32_t>(idx), subsheet.getPixel(m_img.bpp, idx));
|
||||
m_palIdx = palIdx;
|
||||
}
|
||||
|
||||
DrawCommand::DrawCommand(
|
||||
@ -24,12 +24,12 @@ DrawCommand::DrawCommand(
|
||||
const ox::Vector<std::size_t> &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<uint32_t>(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<int>(CommandId::Draw);
|
||||
}
|
||||
|
||||
TileSheet::SubSheetIdx const &DrawCommand::subsheetIdx() const noexcept {
|
||||
TileSheet::SubSheetIdx const&DrawCommand::subsheetIdx() const noexcept {
|
||||
return m_subSheetIdx;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ int InsertTilesCommand::commandId() const noexcept {
|
||||
return static_cast<int>(CommandId::InsertTile);
|
||||
}
|
||||
|
||||
TileSheet::SubSheetIdx const &InsertTilesCommand::subsheetIdx() const noexcept {
|
||||
TileSheet::SubSheetIdx const&InsertTilesCommand::subsheetIdx() const noexcept {
|
||||
return m_idx;
|
||||
}
|
||||
|
||||
|
@ -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<ox::BString<43>>("uuid://{}", newPalette));
|
||||
m_idx(std::move(idx)),
|
||||
m_oldPalette(m_img.defaultPalette),
|
||||
m_newPalette(ox::FileAddress(ox::sfmt<ox::BString<43>>("uuid://{}", newPalette))) {
|
||||
}
|
||||
|
||||
void PaletteChangeCommand::redo() noexcept {
|
||||
@ -28,7 +28,7 @@ int PaletteChangeCommand::commandId() const noexcept {
|
||||
return static_cast<int>(CommandId::PaletteChange);
|
||||
}
|
||||
|
||||
TileSheet::SubSheetIdx const &PaletteChangeCommand::subsheetIdx() const noexcept {
|
||||
TileSheet::SubSheetIdx const&PaletteChangeCommand::subsheetIdx() const noexcept {
|
||||
return m_idx;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ int RmSubSheetCommand::commandId() const noexcept {
|
||||
return static_cast<int>(CommandId::RmSubSheet);
|
||||
}
|
||||
|
||||
TileSheet::SubSheetIdx const &RmSubSheetCommand::subsheetIdx() const noexcept {
|
||||
TileSheet::SubSheetIdx const&RmSubSheetCommand::subsheetIdx() const noexcept {
|
||||
return m_idx;
|
||||
}
|
||||
|
||||
|
@ -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<int>(CommandId::UpdateSubSheet);
|
||||
}
|
||||
|
||||
TileSheet::SubSheetIdx const &UpdateSubSheetCommand::subsheetIdx() const noexcept {
|
||||
TileSheet::SubSheetIdx const&UpdateSubSheetCommand::subsheetIdx() const noexcept {
|
||||
return m_idx;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user