mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-13 20:36:19 -05:00
Make flood fill respect whole metatile selection, including smart path. Smart path is now a checkbox
This commit is contained in:
42
map.cpp
42
map.cpp
@@ -389,7 +389,7 @@ void Map::drawSelection(int i, int w, int selectionWidth, int selectionHeight, Q
|
||||
int y = i / w;
|
||||
painter->save();
|
||||
|
||||
QColor penColor = smart_paths_enabled ? QColor(0xff, 0x0, 0xff) : QColor(0xff, 0xff, 0xff);
|
||||
QColor penColor = QColor(0xff, 0xff, 0xff);
|
||||
painter->setPen(penColor);
|
||||
int rectWidth = selectionWidth * 16;
|
||||
int rectHeight = selectionHeight * 16;
|
||||
@@ -477,38 +477,6 @@ void Map::_setBlock(int x, int y, Block block) {
|
||||
}
|
||||
}
|
||||
|
||||
void Map::_floodFill(int x, int y, uint tile) {
|
||||
QList<QPoint> todo;
|
||||
todo.append(QPoint(x, y));
|
||||
while (todo.length()) {
|
||||
QPoint point = todo.takeAt(0);
|
||||
x = point.x();
|
||||
y = point.y();
|
||||
Block *block = getBlock(x, y);
|
||||
if (block == NULL) {
|
||||
continue;
|
||||
}
|
||||
uint old_tile = block->tile;
|
||||
if (old_tile == tile) {
|
||||
continue;
|
||||
}
|
||||
block->tile = tile;
|
||||
_setBlock(x, y, *block);
|
||||
if ((block = getBlock(x + 1, y)) && block->tile == old_tile) {
|
||||
todo.append(QPoint(x + 1, y));
|
||||
}
|
||||
if ((block = getBlock(x - 1, y)) && block->tile == old_tile) {
|
||||
todo.append(QPoint(x - 1, y));
|
||||
}
|
||||
if ((block = getBlock(x, y + 1)) && block->tile == old_tile) {
|
||||
todo.append(QPoint(x, y + 1));
|
||||
}
|
||||
if ((block = getBlock(x, y - 1)) && block->tile == old_tile) {
|
||||
todo.append(QPoint(x, y - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Map::_floodFillCollision(int x, int y, uint collision) {
|
||||
QList<QPoint> todo;
|
||||
todo.append(QPoint(x, y));
|
||||
@@ -666,14 +634,6 @@ void Map::setBlock(int x, int y, Block block) {
|
||||
}
|
||||
}
|
||||
|
||||
void Map::floodFill(int x, int y, uint tile) {
|
||||
Block *block = getBlock(x, y);
|
||||
if (block && block->tile != tile) {
|
||||
_floodFill(x, y, tile);
|
||||
commit();
|
||||
}
|
||||
}
|
||||
|
||||
void Map::floodFillCollision(int x, int y, uint collision) {
|
||||
Block *block = getBlock(x, y);
|
||||
if (block && block->collision != collision) {
|
||||
|
||||
Reference in New Issue
Block a user