File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,8 @@ namespace {
46
46
47
47
const int snap_grid_sizes[4 ] = {4 , 8 , 16 , 32 };
48
48
49
+ const int MAX_FILL_STACK_SIZE = 1000000 ;
50
+
49
51
bool is_position_inside_tilemap (const TileMap* tilemap, const Vector& pos)
50
52
{
51
53
return pos.x >= 0 && pos.y >= 0 &&
@@ -387,21 +389,18 @@ EditorOverlayWidget::fill()
387
389
return ;
388
390
}
389
391
390
- std::vector<Vector> pos_stack;
391
- pos_stack.clear ();
392
- pos_stack.push_back (m_hovered_tile);
392
+ std::vector<Vector> pos_stack = { m_hovered_tile };
393
393
394
- // Passing recursively trough all tiles to be replaced...
394
+ // Passing recursively through all tiles to be replaced...
395
395
while (pos_stack.size ())
396
396
{
397
-
398
- if (pos_stack.size () > 1000000 )
397
+ if (pos_stack.size () > MAX_FILL_STACK_SIZE)
399
398
{
400
399
log_warning << " More than 1'000'000 tiles in stack to fill, STOP" << std::endl;
401
400
return ;
402
401
}
403
402
404
- Vector pos = pos_stack[pos_stack. size () - 1 ] ;
403
+ Vector pos = pos_stack. back () ;
405
404
Vector tpos = pos - m_hovered_tile;
406
405
407
406
// Tests for being inside tilemap:
You can’t perform that action at this time.
0 commit comments