Early exit magic fill if it would be a no-op

This commit is contained in:
Marcus Huderle 2020-06-27 17:14:37 -05:00
parent 370221a974
commit 7392105297

View file

@ -322,6 +322,11 @@ void MapPixmapItem::magicFill(
bool fromScriptCall) { bool fromScriptCall) {
Block *block = map->getBlock(initialX, initialY); Block *block = map->getBlock(initialX, initialY);
if (block) { if (block) {
if (selectedMetatiles->length() == 1 && selectedMetatiles->value(0) == block->tile) {
logInfo("early exit");
return;
}
bool setCollisions = selectedCollisions && selectedCollisions->length() == selectedMetatiles->length(); bool setCollisions = selectedCollisions && selectedCollisions->length() == selectedMetatiles->length();
uint16_t tile = block->tile; uint16_t tile = block->tile;
for (int y = 0; y < map->getHeight(); y++) { for (int y = 0; y < map->getHeight(); y++) {