From 096c26b85ae02ca972554085e24a3a757507ed56 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 17 Feb 2023 15:40:10 -0500 Subject: [PATCH] Fix label history being ignored if metatile didn't change --- src/ui/tileseteditor.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ui/tileseteditor.cpp b/src/ui/tileseteditor.cpp index 7381b1c9..e06e33ad 100644 --- a/src/ui/tileseteditor.cpp +++ b/src/ui/tileseteditor.cpp @@ -842,15 +842,16 @@ void TilesetEditor::onPaletteEditorChangedPalette(int paletteId) { this->on_spinBox_paletteSelector_valueChanged(paletteId); } -bool TilesetEditor::replaceMetatile(uint16_t metatileId, const Metatile * src, QString label) +bool TilesetEditor::replaceMetatile(uint16_t metatileId, const Metatile * src, QString newLabel) { Metatile * dest = Tileset::getMetatile(metatileId, this->primaryTileset, this->secondaryTileset); - if (!dest || !src || *dest == *src) + QString oldLabel = Tileset::getOwnedMetatileLabel(metatileId, this->primaryTileset, this->secondaryTileset); + if (!dest || !src || (*dest == *src && oldLabel == newLabel)) return false; - Tileset::setMetatileLabel(metatileId, label, this->primaryTileset, this->secondaryTileset); + Tileset::setMetatileLabel(metatileId, newLabel, this->primaryTileset, this->secondaryTileset); if (metatileId == this->getSelectedMetatileId()) - this->ui->lineEdit_metatileLabel->setText(label); + this->ui->lineEdit_metatileLabel->setText(newLabel); this->metatile = dest; *this->metatile = *src;