33// SPDX-License-Identifier: GPL-2.0-or-later
44
55#include " GamePlayer.h"
6+ #include " RttrForeachPt.h"
67#include " buildings/nobMilitary.h"
78#include " factories/BuildingFactory.h"
89#include " helpers/Range.h"
@@ -359,23 +360,19 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceReachabilityConsidersStaticObjectBlocker
359360 const MapPoint endPt (10 , corridorY);
360361 constexpr unsigned maxPathLen = 8 ;
361362
362- for ( const auto y : helpers::range ( 0 , + world.GetHeight () ))
363+ RTTR_FOREACH_PT (MapPoint, world.GetSize ( ))
363364 {
364- for (const auto x : helpers::range (0 , +world.GetWidth ()))
365- {
366- const MapPoint pt (x, y);
367- if (pt.y == corridorY && pt.x >= startPt.x && pt.x <= endPt.x )
368- continue ;
365+ if (pt.y == corridorY && pt.x >= startPt.x && pt.x <= endPt.x )
366+ continue ;
369367
370- MapNode& node = world.GetNodeWriteable (pt);
371- node.t1 = tWater;
372- node.t2 = tWater;
373- }
368+ MapNode& node = world.GetNodeWriteable (pt);
369+ node.t1 = tWater;
370+ node.t2 = tWater;
374371 }
375372
376373 BOOST_TEST_REQUIRE (DoesReachablePathExist (world, startPt, endPt, maxPathLen));
377374
378- for (unsigned x = startPt.x + 1 ; x < endPt.x ; ++x )
375+ for (const unsigned x : helpers::range<MapCoord>( startPt.x + 1 , endPt.x ) )
379376 {
380377 const MapPoint passablePt (x, corridorY);
381378 world.DestroyNO (passablePt, false );
@@ -384,7 +381,7 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceReachabilityConsidersStaticObjectBlocker
384381
385382 BOOST_TEST_REQUIRE (DoesReachablePathExist (world, startPt, endPt, maxPathLen));
386383
387- for (unsigned x = startPt.x + 1 ; x < endPt.x ; ++x )
384+ for (const unsigned x : helpers::range<MapCoord>( startPt.x + 1 , endPt.x ) )
388385 {
389386 const MapPoint passablePt (x, corridorY);
390387 world.DestroyNO (passablePt, false );
@@ -393,7 +390,7 @@ BOOST_FIXTURE_TEST_CASE(FrontierDistanceReachabilityConsidersStaticObjectBlocker
393390
394391 BOOST_TEST_REQUIRE (DoesReachablePathExist (world, startPt, endPt, maxPathLen));
395392
396- for (unsigned x = startPt.x + 1 ; x < endPt.x ; ++x )
393+ for (const unsigned x : helpers::range<MapCoord>( startPt.x + 1 , endPt.x ) )
397394 {
398395 const MapPoint blockerPt (x, corridorY);
399396 world.DestroyNO (blockerPt, false );
0 commit comments