Skip to content

Commit 18f1eb0

Browse files
committed
Revert "Make GI_GetCheats noexcept"
This reverts commit 199817b.
1 parent 2fb5dd3 commit 18f1eb0

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

libs/s25main/GameInterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ class GameInterface
3737
/// Executes the construction of a road
3838
virtual void GI_BuildRoad() = 0;
3939

40-
virtual Cheats& GI_GetCheats() noexcept = 0;
40+
virtual Cheats& GI_GetCheats() = 0;
4141
};

libs/s25main/desktops/dskGameInterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class dskGameInterface :
8484
/// Baut die gewünschte bis jetzt noch visuelle Straße (schickt Anfrage an Server)
8585
void GI_BuildRoad() override;
8686

87-
Cheats& GI_GetCheats() noexcept override { return cheats_; }
87+
Cheats& GI_GetCheats() override { return cheats_; }
8888

8989
// Sucht einen Weg von road_point_x/y zu cselx/y und baut ihn ( nur visuell )
9090
// Bei Wasserwegen kann die Reichweite nicht bis zum gewünschten

tests/s25Main/integration/testCheats.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,15 @@ MOCK_BASE_CLASS(MockGameInterface, GameInterface)
5252
MOCK_METHOD(GI_TeamWinner, 1)
5353
MOCK_METHOD(GI_StartRoadBuilding, 2)
5454
MOCK_METHOD(GI_CancelRoadBuilding, 0)
55-
MOCK_METHOD(GI_BuildRoad, 0);
56-
57-
// can't mock noexcept function in turtle - working around it
58-
MockGameInterface(Cheats & cheats) : cheats_{cheats} {}
59-
Cheats & cheats_;
60-
Cheats& GI_GetCheats() noexcept override
61-
{
62-
return cheats_;
63-
}
55+
MOCK_METHOD(GI_BuildRoad, 0)
56+
MOCK_METHOD(GI_GetCheats, 0)
6457
};
6558
} // namespace
6659

6760
BOOST_FIXTURE_TEST_CASE(CanToggleAllVisible_IfCheatModeIsOn_ButOnlyDisableAllVisible_IfCheatModeIsNotOn, CheatsFixture)
6861
{
69-
MockGameInterface mgi{gameDesktop.GI_GetCheats()};
62+
MockGameInterface mgi;
63+
MOCK_EXPECT(mgi.GI_GetCheats).returns(std::ref(gameDesktop.GI_GetCheats()));
7064
MOCK_EXPECT(mgi.GI_UpdateMapVisibility).exactly(4); // because the actual toggling should occur 4 times
7165
world.SetGameInterface(&mgi);
7266

0 commit comments

Comments
 (0)