From 2a11760afdb736a4a79ca647f8ccda126537b9ca Mon Sep 17 00:00:00 2001 From: garakmon Date: Tue, 4 Aug 2020 18:24:37 -0400 Subject: [PATCH] fix error in script edit command --- include/core/editcommands.h | 2 +- src/core/editcommands.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/core/editcommands.h b/include/core/editcommands.h index 3743c69d..032f3dc9 100644 --- a/include/core/editcommands.h +++ b/include/core/editcommands.h @@ -345,7 +345,7 @@ public: void undo() override; void redo() override; - bool mergeWith(const QUndoCommand *) override { return false; }; + bool mergeWith(const QUndoCommand *) override { return false; } int id() const override { return CommandId::ID_ScriptEditMap; } private: diff --git a/src/core/editcommands.cpp b/src/core/editcommands.cpp index 8259e308..8c2b072a 100644 --- a/src/core/editcommands.cpp +++ b/src/core/editcommands.cpp @@ -498,10 +498,10 @@ ScriptEditMap::ScriptEditMap(Map *map, this->newMetatiles = newMetatiles; this->oldMetatiles = oldMetatiles; - this->oldMapWidth = oldMapWidth; - this->oldMapHeight = oldMapHeight; - this->newMapWidth = newMapWidth; - this->newMapHeight = newMapHeight; + this->oldMapWidth = oldMapDimensions.width(); + this->oldMapHeight = oldMapDimensions.height(); + this->newMapWidth = newMapDimensions.width(); + this->newMapHeight = newMapDimensions.height(); } ScriptEditMap::~ScriptEditMap() { @@ -517,7 +517,7 @@ void ScriptEditMap::redo() { if (map->layout->blockdata) { map->layout->blockdata->copyFrom(newMetatiles); if (newMapWidth != map->getWidth() || newMapHeight != map->getHeight()) { - map->setDimensions(newMapWidth, newMapHeight); + map->setDimensions(newMapWidth, newMapHeight, false); } } @@ -533,7 +533,7 @@ void ScriptEditMap::undo() { if (map->layout->blockdata) { map->layout->blockdata->copyFrom(oldMetatiles); if (oldMapWidth != map->getWidth() || oldMapHeight != map->getHeight()) { - map->setDimensions(oldMapWidth, oldMapHeight); + map->setDimensions(oldMapWidth, oldMapHeight, false); } }