[nostalgia/core/studio] Cleanup TileSheetEditor commands

This commit is contained in:
Gary Talent 2023-12-10 17:27:18 -06:00
parent 4a94672fdc
commit b6b59e77f5
8 changed files with 21 additions and 21 deletions

View File

@ -11,7 +11,7 @@ AddSubSheetCommand::AddSubSheetCommand(
TileSheet::SubSheetIdx parentIdx) noexcept: TileSheet::SubSheetIdx parentIdx) noexcept:
m_img(img), m_parentIdx(std::move(parentIdx)) { m_img(img), m_parentIdx(std::move(parentIdx)) {
auto &parent = m_img.getSubSheet(m_parentIdx); auto &parent = m_img.getSubSheet(m_parentIdx);
if (parent.subsheets.size()) { if (!parent.subsheets.empty()) {
auto idx = m_parentIdx; auto idx = m_parentIdx;
idx.emplace_back(parent.subsheets.size()); idx.emplace_back(parent.subsheets.size());
m_addedSheets.push_back(idx); m_addedSheets.push_back(idx);

View File

@ -12,10 +12,10 @@ DrawCommand::DrawCommand(
std::size_t idx, std::size_t idx,
int palIdx) noexcept: int palIdx) noexcept:
m_img(img), m_img(img),
m_subSheetIdx(std::move(subSheetIdx)) { m_subSheetIdx(std::move(subSheetIdx)),
m_palIdx(palIdx) {
auto &subsheet = m_img.getSubSheet(m_subSheetIdx); auto &subsheet = m_img.getSubSheet(m_subSheetIdx);
m_changes.emplace_back(static_cast<uint32_t>(idx), subsheet.getPixel(m_img.bpp, idx)); m_changes.emplace_back(static_cast<uint32_t>(idx), subsheet.getPixel(m_img.bpp, idx));
m_palIdx = palIdx;
} }
DrawCommand::DrawCommand( DrawCommand::DrawCommand(
@ -24,12 +24,12 @@ DrawCommand::DrawCommand(
const ox::Vector<std::size_t> &idxList, const ox::Vector<std::size_t> &idxList,
int palIdx) noexcept: int palIdx) noexcept:
m_img(img), m_img(img),
m_subSheetIdx(std::move(subSheetIdx)) { m_subSheetIdx(std::move(subSheetIdx)),
m_palIdx(palIdx) {
auto &subsheet = m_img.getSubSheet(m_subSheetIdx); auto &subsheet = m_img.getSubSheet(m_subSheetIdx);
for (const auto idx : idxList) { for (const auto idx : idxList) {
m_changes.emplace_back(static_cast<uint32_t>(idx), subsheet.getPixel(m_img.bpp, idx)); 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 { bool DrawCommand::append(std::size_t idx) noexcept {

View File

@ -11,9 +11,9 @@ core::PaletteChangeCommand::PaletteChangeCommand(
TileSheet &img, TileSheet &img,
ox::CRStringView newPalette) noexcept: ox::CRStringView newPalette) noexcept:
m_img(img), m_img(img),
m_idx(std::move(idx)) { m_idx(std::move(idx)),
m_oldPalette = m_img.defaultPalette; m_oldPalette(m_img.defaultPalette),
m_newPalette = ox::FileAddress(ox::sfmt<ox::BString<43>>("uuid://{}", newPalette)); m_newPalette(ox::FileAddress(ox::sfmt<ox::BString<43>>("uuid://{}", newPalette))) {
} }
void PaletteChangeCommand::redo() noexcept { void PaletteChangeCommand::redo() noexcept {

View File

@ -13,11 +13,11 @@ core::UpdateSubSheetCommand::UpdateSubSheetCommand(
int cols, int cols,
int rows) noexcept: int rows) noexcept:
m_img(img), m_img(img),
m_idx(std::move(idx)) { m_idx(std::move(idx)),
m_sheet = m_img.getSubSheet(m_idx); m_sheet(m_img.getSubSheet(m_idx)),
m_newName = std::move(name); m_newName(std::move(name)),
m_newCols = cols; m_newCols(cols),
m_newRows = rows; m_newRows(rows) {
} }
void UpdateSubSheetCommand::redo() noexcept { void UpdateSubSheetCommand::redo() noexcept {