Scriptapi: fix segfault in shift(), add missing flag to the caller of shift()

This commit is contained in:
BigBahss 2021-02-15 21:21:07 -05:00 committed by huderlem
parent 107ef528e2
commit c1303d98c3
2 changed files with 2 additions and 2 deletions

View file

@ -149,7 +149,7 @@ void MainWindow::magicFillFromSelection(int x, int y, bool forceRedraw, bool com
void MainWindow::shift(int xDelta, int yDelta, bool forceRedraw, bool commitChanges) {
if (!this->editor || !this->editor->map)
return;
this->editor->map_item->shift(xDelta, yDelta);
this->editor->map_item->shift(xDelta, yDelta, true);
this->tryCommitMapChanges(commitChanges);
this->tryRedrawMapArea(forceRedraw);
}

View file

@ -76,7 +76,7 @@ void MapPixmapItem::shift(QGraphicsSceneMouseEvent *event) {
}
void MapPixmapItem::shift(int xDelta, int yDelta, bool fromScriptCall) {
Blockdata oldMetatiles = !fromScriptCall ? map->layout->blockdata : Blockdata();
Blockdata oldMetatiles = map->layout->blockdata;
for (int i = 0; i < map->getWidth(); i++)
for (int j = 0; j < map->getHeight(); j++) {