Skip to content

Commit 58c0217

Browse files
committed
Clean up isolated fish water test
1 parent 9c5a98f commit 58c0217

2 files changed

Lines changed: 7 additions & 11 deletions

File tree

libs/s25main/figures/nofFisher.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ class nofFisher : public nofFarmhand
2626
/// Abgeleitete Klasse informieren, wenn fertig ist mit Arbeiten
2727
void WorkFinished() override;
2828

29-
/// Returns the quality of this working point or determines if the worker can work here at all
30-
PointQuality GetPointQuality(MapPoint pt, bool isBeforeWork) const override;
31-
3229
public:
3330
nofFisher(MapPoint pos, unsigned char player, nobUsual* workplace);
3431
nofFisher(SerializedGameData& sgd, unsigned obj_id);
@@ -38,4 +35,7 @@ class nofFisher : public nofFarmhand
3835
void Serialize(SerializedGameData& sgd) const override;
3936

4037
GO_Type GetGOT() const final { return GO_Type::NofFisher; }
38+
39+
/// Returns the quality of this working point or determines if the worker can work here at all
40+
PointQuality GetPointQuality(MapPoint pt, bool isBeforeWork) const override;
4141
};

tests/s25Main/integration/testBuilding.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
#include "RttrForeachPt.h"
88
#include "buildings/nobBaseMilitary.h"
99
#include "buildings/nobUsual.h"
10+
#include "desktops/dskGameInterface.h"
1011
#include "factories/BuildingFactory.h"
1112
#include "figures/nofFarmhand.h"
1213
#include "figures/nofFisher.h"
13-
#include "gameTypes/Resource.h"
14-
#include "desktops/dskGameInterface.h"
1514
#include "helpers/containerUtils.h"
1615
#include "uiHelper/uiHelpers.hpp"
1716
#include "worldFixtures/CreateEmptyWorld.h"
@@ -21,6 +20,7 @@
2120
#include "nodeObjs/noEnvObject.h"
2221
#include "nodeObjs/noStaticObject.h"
2322
#include "gameTypes/GameTypesOutput.h"
23+
#include "gameTypes/Resource.h"
2424
#include <boost/test/unit_test.hpp>
2525

2626
// LCOV_EXCL_START
@@ -482,7 +482,6 @@ BOOST_FIXTURE_TEST_CASE(RoadRemovesObjs, EmptyWorldFixture1P)
482482
}
483483
}
484484

485-
486485
BOOST_FIXTURE_TEST_CASE(FisherIgnoresIsolatedFishWater, EmptyWorldFixture1PBiggest)
487486
{
488487
const DescIdx<TerrainDesc> tWater = GetWaterTerrain(world.GetDescription());
@@ -493,7 +492,6 @@ BOOST_FIXTURE_TEST_CASE(FisherIgnoresIsolatedFishWater, EmptyWorldFixture1PBigge
493492
BOOST_TEST_REQUIRE(fishery);
494493

495494
nofFisher fisher(fisheryPos, 0, fishery);
496-
const nofFarmhand& farmhand = fisher;
497495

498496
const MapPoint workPt = world.MakeMapPoint(fisheryPos + Position(4, 0));
499497
const MapPoint fishPt = world.GetNeighbour(workPt, Direction::East);
@@ -515,12 +513,10 @@ BOOST_FIXTURE_TEST_CASE(FisherIgnoresIsolatedFishWater, EmptyWorldFixture1PBigge
515513
makeWaterPoint(fishPt);
516514
world.SetResource(fishPt, Resource(ResourceType::Fish, 4));
517515

518-
BOOST_TEST_REQUIRE(static_cast<unsigned>(farmhand.GetPointQuality(workPt))
519-
== static_cast<unsigned>(nofFarmhand::PointQuality::NotPossible));
516+
BOOST_TEST_REQUIRE((fisher.GetPointQuality(workPt, false) == nofFarmhand::PointQuality::NotPossible));
520517

521518
makeWaterPoint(world.GetNeighbour(fishPt, Direction::East));
522519

523-
BOOST_TEST_REQUIRE(static_cast<unsigned>(farmhand.GetPointQuality(workPt))
524-
== static_cast<unsigned>(nofFarmhand::PointQuality::Class1));
520+
BOOST_TEST_REQUIRE((fisher.GetPointQuality(workPt, false) == nofFarmhand::PointQuality::Class1));
525521
}
526522
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)