From 89c524a13d4fdeac77cfa36d6c818d9a8aa18d18 Mon Sep 17 00:00:00 2001 From: lukas Date: Thu, 16 Jul 2026 15:33:55 +0200 Subject: [PATCH 1/9] fixed emergency protocol by removing sheduled wares requested before activation --- libs/s25main/GamePlayer.cpp | 22 ++++++++++++++++++++++ libs/s25main/GamePlayer.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/libs/s25main/GamePlayer.cpp b/libs/s25main/GamePlayer.cpp index c444ebc90e..e20ac12cd7 100644 --- a/libs/s25main/GamePlayer.cpp +++ b/libs/s25main/GamePlayer.cpp @@ -2089,6 +2089,25 @@ bool GamePlayer::FindHarborForUnloading(noShip* ship, const MapPoint start, Harb return false; } +void GamePlayer::CancelWaresForEmergencyProtocol() +{ + for(auto it = ware_list.begin(); it != ware_list.end();){ + Ware * ware = *it; + if(ware->IsWaitingInWarehouse()) + { + auto* goal = ware->GetGoal(); + if(goal != nullptr && goal->GetBuildingType() != BuildingType::Sawmill && goal->GetBuildingType() != BuildingType::Woodcutter) + { + ware->NotifyGoalAboutLostWare(); + static_cast(ware->GetLocation())->CancelWare(ware); + it = ware_list.erase(it); + continue; + } + } + it++; + } +} + void GamePlayer::TestForEmergencyProgramm() { // we are already defeated, do not even think about an emergency program - it's too late :-( @@ -2119,6 +2138,9 @@ void GamePlayer::TestForEmergencyProgramm() SendPostMessage(std::make_unique( world.GetEvMgr().GetCurrentGF(), _("The emergency program has been activated."), PostCategory::Economy)); } + + //remove all existing ware deliveries to buildings not sawmill or woodcutter + CancelWaresForEmergencyProtocol(); } else { // Sobald Notfall vorbei, Notfallprogramm beenden, evtl. Baustellen wieder mit Kram versorgen diff --git a/libs/s25main/GamePlayer.h b/libs/s25main/GamePlayer.h index ada0ba552a..beb910ee5f 100644 --- a/libs/s25main/GamePlayer.h +++ b/libs/s25main/GamePlayer.h @@ -331,6 +331,8 @@ class GamePlayer : public GamePlayerInfo const Statistic& GetStatistic(StatisticTime time) const { return statistic[time]; }; unsigned GetStatisticCurrentValue(StatisticType idx) const { return statisticCurrentData[idx]; } + // Lösht alle waren die bereits zur Auslieferung vorbereitet sind aber dem Notfallprogramm wiedersprechen + void CancelWaresForEmergencyProtocol(); // Testet ob Notfallprogramm aktiviert werden muss und tut dies dann void TestForEmergencyProgramm(); bool hasEmergency() const { return emergency; } From 0e13b2c0808d8cfbb860fbd0dbe33ad92c498dff Mon Sep 17 00:00:00 2001 From: lukas Date: Thu, 16 Jul 2026 16:26:40 +0200 Subject: [PATCH 2/9] added type = boards for additinal condigion to remove from emergency wares --- libs/s25main/GamePlayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/s25main/GamePlayer.cpp b/libs/s25main/GamePlayer.cpp index e20ac12cd7..7229e44dca 100644 --- a/libs/s25main/GamePlayer.cpp +++ b/libs/s25main/GamePlayer.cpp @@ -2093,7 +2093,7 @@ void GamePlayer::CancelWaresForEmergencyProtocol() { for(auto it = ware_list.begin(); it != ware_list.end();){ Ware * ware = *it; - if(ware->IsWaitingInWarehouse()) + if(ware->type == GoodType::Boards && ware->IsWaitingInWarehouse()) { auto* goal = ware->GetGoal(); if(goal != nullptr && goal->GetBuildingType() != BuildingType::Sawmill && goal->GetBuildingType() != BuildingType::Woodcutter) From 97f5b63c1de661fcbdd7f434559ddeb83bdfadbe Mon Sep 17 00:00:00 2001 From: lukas Date: Thu, 16 Jul 2026 17:41:16 +0200 Subject: [PATCH 3/9] pr improvements (comments, extra check emergency ware function, check only on activation) --- libs/s25main/GamePlayer.cpp | 28 ++++++++++++++-------------- libs/s25main/GamePlayer.h | 3 ++- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/libs/s25main/GamePlayer.cpp b/libs/s25main/GamePlayer.cpp index 7229e44dca..8f44195dd2 100644 --- a/libs/s25main/GamePlayer.cpp +++ b/libs/s25main/GamePlayer.cpp @@ -889,6 +889,10 @@ void GamePlayer::FindWarehouseForAllJobs(const Job job) } } +bool GamePlayer::IsWareFineWithEmergencyProtocol(GoodType goodType, const noBaseBuilding& goal){ + return (goodType != GoodType::Boards && goodType != GoodType::Stones) || goal.GetBuildingType() == BuildingType::Woodcutter || goal.GetBuildingType() == BuildingType::Sawmill; +} + Ware* GamePlayer::OrderWare(const GoodType ware, noBaseBuilding& goal) { /// Gibt es ein Lagerhaus mit dieser Ware? @@ -902,8 +906,7 @@ Ware* GamePlayer::OrderWare(const GoodType ware, noBaseBuilding& goal) else { // Wenn Notfallprogramm aktiv nur an Holzfäller und Sägewerke Bretter/Steine liefern - if((ware != GoodType::Boards && ware != GoodType::Stones) - || goal.GetBuildingType() == BuildingType::Woodcutter || goal.GetBuildingType() == BuildingType::Sawmill) + if(IsWareFineWithEmergencyProtocol(ware,goal)) return wh->OrderWare(ware, goal); else return nullptr; @@ -2093,16 +2096,13 @@ void GamePlayer::CancelWaresForEmergencyProtocol() { for(auto it = ware_list.begin(); it != ware_list.end();){ Ware * ware = *it; - if(ware->type == GoodType::Boards && ware->IsWaitingInWarehouse()) + // checks if this ware is + if(ware->IsWaitingInWarehouse() && !IsWareFineWithEmergencyProtocol(ware->type,*ware->GetGoal())) { - auto* goal = ware->GetGoal(); - if(goal != nullptr && goal->GetBuildingType() != BuildingType::Sawmill && goal->GetBuildingType() != BuildingType::Woodcutter) - { - ware->NotifyGoalAboutLostWare(); - static_cast(ware->GetLocation())->CancelWare(ware); - it = ware_list.erase(it); - continue; - } + ware->NotifyGoalAboutLostWare(); + static_cast(ware->GetLocation())->CancelWare(ware); + it = ware_list.erase(it); + continue; } it++; } @@ -2137,10 +2137,10 @@ void GamePlayer::TestForEmergencyProgramm() emergency = true; SendPostMessage(std::make_unique( world.GetEvMgr().GetCurrentGF(), _("The emergency program has been activated."), PostCategory::Economy)); - } - //remove all existing ware deliveries to buildings not sawmill or woodcutter - CancelWaresForEmergencyProtocol(); + //Handle wares already ordered + CancelWaresForEmergencyProtocol(); + } } else { // Sobald Notfall vorbei, Notfallprogramm beenden, evtl. Baustellen wieder mit Kram versorgen diff --git a/libs/s25main/GamePlayer.h b/libs/s25main/GamePlayer.h index beb910ee5f..20b06a8975 100644 --- a/libs/s25main/GamePlayer.h +++ b/libs/s25main/GamePlayer.h @@ -331,7 +331,8 @@ class GamePlayer : public GamePlayerInfo const Statistic& GetStatistic(StatisticTime time) const { return statistic[time]; }; unsigned GetStatisticCurrentValue(StatisticType idx) const { return statisticCurrentData[idx]; } - // Lösht alle waren die bereits zur Auslieferung vorbereitet sind aber dem Notfallprogramm wiedersprechen + bool IsWareFineWithEmergencyProtocol(GoodType goodType, const noBaseBuilding& goal); + // remove all wares that are already scheduled but ignoring emergency protocol void CancelWaresForEmergencyProtocol(); // Testet ob Notfallprogramm aktiviert werden muss und tut dies dann void TestForEmergencyProgramm(); From 324d8ed2b9f2225891daa0cabdc9a89ab7fdf77b Mon Sep 17 00:00:00 2001 From: lukas Date: Fri, 17 Jul 2026 12:07:50 +0200 Subject: [PATCH 4/9] pr-improvements (nullcheck, static function) --- libs/s25main/GamePlayer.cpp | 4 ++-- libs/s25main/GamePlayer.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/s25main/GamePlayer.cpp b/libs/s25main/GamePlayer.cpp index 8f44195dd2..896594e134 100644 --- a/libs/s25main/GamePlayer.cpp +++ b/libs/s25main/GamePlayer.cpp @@ -889,7 +889,7 @@ void GamePlayer::FindWarehouseForAllJobs(const Job job) } } -bool GamePlayer::IsWareFineWithEmergencyProtocol(GoodType goodType, const noBaseBuilding& goal){ +static bool IsWareFineWithEmergencyProtocol(GoodType goodType, const noBaseBuilding& goal){ return (goodType != GoodType::Boards && goodType != GoodType::Stones) || goal.GetBuildingType() == BuildingType::Woodcutter || goal.GetBuildingType() == BuildingType::Sawmill; } @@ -2097,7 +2097,7 @@ void GamePlayer::CancelWaresForEmergencyProtocol() for(auto it = ware_list.begin(); it != ware_list.end();){ Ware * ware = *it; // checks if this ware is - if(ware->IsWaitingInWarehouse() && !IsWareFineWithEmergencyProtocol(ware->type,*ware->GetGoal())) + if(ware->IsWaitingInWarehouse() && ware->GetGoal() != nullptr && !IsWareFineWithEmergencyProtocol(ware->type,*ware->GetGoal())) { ware->NotifyGoalAboutLostWare(); static_cast(ware->GetLocation())->CancelWare(ware); diff --git a/libs/s25main/GamePlayer.h b/libs/s25main/GamePlayer.h index 20b06a8975..04cbda484b 100644 --- a/libs/s25main/GamePlayer.h +++ b/libs/s25main/GamePlayer.h @@ -331,7 +331,6 @@ class GamePlayer : public GamePlayerInfo const Statistic& GetStatistic(StatisticTime time) const { return statistic[time]; }; unsigned GetStatisticCurrentValue(StatisticType idx) const { return statisticCurrentData[idx]; } - bool IsWareFineWithEmergencyProtocol(GoodType goodType, const noBaseBuilding& goal); // remove all wares that are already scheduled but ignoring emergency protocol void CancelWaresForEmergencyProtocol(); // Testet ob Notfallprogramm aktiviert werden muss und tut dies dann From 9dac6095cd3d9b1319d20c10d8441431fbfa841c Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Fri, 17 Jul 2026 12:28:05 +0200 Subject: [PATCH 5/9] Remove comparison to nullptr --- libs/s25main/GamePlayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/s25main/GamePlayer.cpp b/libs/s25main/GamePlayer.cpp index 896594e134..aef834687f 100644 --- a/libs/s25main/GamePlayer.cpp +++ b/libs/s25main/GamePlayer.cpp @@ -2097,7 +2097,7 @@ void GamePlayer::CancelWaresForEmergencyProtocol() for(auto it = ware_list.begin(); it != ware_list.end();){ Ware * ware = *it; // checks if this ware is - if(ware->IsWaitingInWarehouse() && ware->GetGoal() != nullptr && !IsWareFineWithEmergencyProtocol(ware->type,*ware->GetGoal())) + if(ware->IsWaitingInWarehouse() && ware->GetGoal() && !IsWareFineWithEmergencyProtocol(ware->type,*ware->GetGoal())) { ware->NotifyGoalAboutLostWare(); static_cast(ware->GetLocation())->CancelWare(ware); From 2b5735f38f4c37671c85dd5a10abb9ca6eeab78f Mon Sep 17 00:00:00 2001 From: lukas Date: Fri, 17 Jul 2026 17:26:23 +0200 Subject: [PATCH 6/9] clang formater --- libs/s25main/GamePlayer.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/libs/s25main/GamePlayer.cpp b/libs/s25main/GamePlayer.cpp index aef834687f..cd23c09feb 100644 --- a/libs/s25main/GamePlayer.cpp +++ b/libs/s25main/GamePlayer.cpp @@ -889,8 +889,10 @@ void GamePlayer::FindWarehouseForAllJobs(const Job job) } } -static bool IsWareFineWithEmergencyProtocol(GoodType goodType, const noBaseBuilding& goal){ - return (goodType != GoodType::Boards && goodType != GoodType::Stones) || goal.GetBuildingType() == BuildingType::Woodcutter || goal.GetBuildingType() == BuildingType::Sawmill; +static bool IsWareFineWithEmergencyProtocol(GoodType goodType, const noBaseBuilding& goal) +{ + return (goodType != GoodType::Boards && goodType != GoodType::Stones) + || goal.GetBuildingType() == BuildingType::Woodcutter || goal.GetBuildingType() == BuildingType::Sawmill; } Ware* GamePlayer::OrderWare(const GoodType ware, noBaseBuilding& goal) @@ -906,7 +908,7 @@ Ware* GamePlayer::OrderWare(const GoodType ware, noBaseBuilding& goal) else { // Wenn Notfallprogramm aktiv nur an Holzfäller und Sägewerke Bretter/Steine liefern - if(IsWareFineWithEmergencyProtocol(ware,goal)) + if(IsWareFineWithEmergencyProtocol(ware, goal)) return wh->OrderWare(ware, goal); else return nullptr; @@ -2094,10 +2096,12 @@ bool GamePlayer::FindHarborForUnloading(noShip* ship, const MapPoint start, Harb void GamePlayer::CancelWaresForEmergencyProtocol() { - for(auto it = ware_list.begin(); it != ware_list.end();){ - Ware * ware = *it; + for(auto it = ware_list.begin(); it != ware_list.end();) + { + Ware* ware = *it; // checks if this ware is - if(ware->IsWaitingInWarehouse() && ware->GetGoal() && !IsWareFineWithEmergencyProtocol(ware->type,*ware->GetGoal())) + if(ware->IsWaitingInWarehouse() && ware->GetGoal() + && !IsWareFineWithEmergencyProtocol(ware->type, *ware->GetGoal())) { ware->NotifyGoalAboutLostWare(); static_cast(ware->GetLocation())->CancelWare(ware); @@ -2138,7 +2142,7 @@ void GamePlayer::TestForEmergencyProgramm() SendPostMessage(std::make_unique( world.GetEvMgr().GetCurrentGF(), _("The emergency program has been activated."), PostCategory::Economy)); - //Handle wares already ordered + // Handle wares already ordered CancelWaresForEmergencyProtocol(); } } else From 0fe2d3c242e8dbc05eb388b84268d8333790b39b Mon Sep 17 00:00:00 2001 From: lukas Date: Sat, 18 Jul 2026 00:52:58 +0200 Subject: [PATCH 7/9] added tests for emergency protocol --- .../integration/testEmergencyProtocol.cpp | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 tests/s25Main/integration/testEmergencyProtocol.cpp diff --git a/tests/s25Main/integration/testEmergencyProtocol.cpp b/tests/s25Main/integration/testEmergencyProtocol.cpp new file mode 100644 index 0000000000..84c447d520 --- /dev/null +++ b/tests/s25Main/integration/testEmergencyProtocol.cpp @@ -0,0 +1,89 @@ +// Copyright (C) 2005 - 2026 Settlers Freaks (sf-team at siedler25.org) +// +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "EconomyModeHandler.h" +#include "EventManager.h" +#include "GamePlayer.h" +#include "Savegame.h" +#include "SerializedGameData.h" +#include "addons/AddonEconomyModeGameLength.h" +#include "factories/BuildingFactory.h" +#include "worldFixtures/MockLocalGameState.h" +#include "worldFixtures/WorldFixture.h" +#include "worldFixtures/WorldWithGCExecution.h" +#include "worldFixtures/initGameRNG.hpp" +#include "gameTypes/GO_Type.h" +#include +#include +#include + +struct EmergencyFixture : public WorldFixture +{ + nobHQ * HQ = world.GetPlayer(0).GetHQ(); + EmergencyFixture() + { + HQ->AddToInventory(HQ->getStartInventory(StartWares::VLow), true); + MapPoint pos; + + pos = world.GetPlayer(0).GetHQPos() + MapPoint(3, 0); + world.SetBuildingSite(BuildingType::Farm, pos, 0); + world.BuildRoad(0, false, world.GetNeighbour(pos, Direction::SouthEast), + std::vector(3, Direction::West)); + + + pos = world.GetPlayer(0).GetHQPos() + MapPoint(-3, 0); + world.SetBuildingSite(BuildingType::Farm, pos, 0); + world.BuildRoad(0, false, world.GetNeighbour(pos, Direction::SouthEast), + std::vector(3, Direction::East)); + + + //wait until emergency protocol should be activated + RTTR_EXEC_TILL(500,HQ->GetInventory()[GoodType::Boards] == 10); + + //activate program (with 10 boards it should trigger) + world.GetPlayer(0).TestForEmergencyProgramm(); + + //wait for some more ticks to give time if not working to deliver more boards + RTTR_SKIP_GFS(200); + //check boards are still fine and protocol working + BOOST_TEST_CHECK(world.GetPlayer(0).GetHQ()->GetInventory()[GoodType::Boards] == 10); + } +}; + +BOOST_FIXTURE_TEST_CASE(EmergencyProtoclActiveWoodcutterAndSawmillCanBuild, EmergencyFixture) +{ + initGameRNG(); + + MapPoint posWoodcutter = world.GetPlayer(0).GetHQPos() + MapPoint(-1, 2); + world.SetBuildingSite(BuildingType::Woodcutter, posWoodcutter, 0); + world.BuildRoad(0, false, world.GetNeighbour(posWoodcutter, Direction::SouthEast), + std::vector(2, Direction::NorthEast)); + + MapPoint posSawmill = world.GetPlayer(0).GetHQPos() + MapPoint(-2, 4); + world.SetBuildingSite(BuildingType::Sawmill, posSawmill, 0); + world.BuildRoad(0, false, world.GetNeighbour(posSawmill, Direction::SouthEast), + std::vector(2, Direction::NorthEast)); + + //check if inventory boards are given out + RTTR_EXEC_TILL(500,HQ->GetInventory()[GoodType::Boards] < 10); + + //check if building where found + RTTR_EXEC_TILL(10000,world.GetNO(posWoodcutter)->GetType() == NodalObjectType::Building); + RTTR_EXEC_TILL(10000,world.GetNO(posSawmill)->GetType() == NodalObjectType::Building); +} + +BOOST_FIXTURE_TEST_CASE(EmergencyProtoclActiveOtherBuldingsnotBuild, EmergencyFixture) +{ + initGameRNG(); + + MapPoint pos = world.GetPlayer(0).GetHQPos() + MapPoint(-1, 2); + world.SetBuildingSite(BuildingType::Watchtower, pos, 0); + world.BuildRoad(0, false, world.GetNeighbour(pos, Direction::SouthEast), + std::vector(2, Direction::NorthEast)); + + //wait for some more ticks to give time if not working to deliver more boards + RTTR_SKIP_GFS(200); + //check boards are still fine and protocol working + BOOST_TEST_CHECK(world.GetPlayer(0).GetHQ()->GetInventory()[GoodType::Boards] == 10); +} From 689112e905ccbeaebd0da1ce17eb521ddbd00be7 Mon Sep 17 00:00:00 2001 From: lukas Date: Sat, 18 Jul 2026 01:01:57 +0200 Subject: [PATCH 8/9] fixed gameframe condition timeouts on emergency protocol tests --- tests/s25Main/integration/testEmergencyProtocol.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/s25Main/integration/testEmergencyProtocol.cpp b/tests/s25Main/integration/testEmergencyProtocol.cpp index 84c447d520..d5b2161255 100644 --- a/tests/s25Main/integration/testEmergencyProtocol.cpp +++ b/tests/s25Main/integration/testEmergencyProtocol.cpp @@ -30,14 +30,12 @@ struct EmergencyFixture : public WorldFixture world.SetBuildingSite(BuildingType::Farm, pos, 0); world.BuildRoad(0, false, world.GetNeighbour(pos, Direction::SouthEast), std::vector(3, Direction::West)); - - + pos = world.GetPlayer(0).GetHQPos() + MapPoint(-3, 0); world.SetBuildingSite(BuildingType::Farm, pos, 0); world.BuildRoad(0, false, world.GetNeighbour(pos, Direction::SouthEast), std::vector(3, Direction::East)); - //wait until emergency protocol should be activated RTTR_EXEC_TILL(500,HQ->GetInventory()[GoodType::Boards] == 10); @@ -66,11 +64,11 @@ BOOST_FIXTURE_TEST_CASE(EmergencyProtoclActiveWoodcutterAndSawmillCanBuild, Emer std::vector(2, Direction::NorthEast)); //check if inventory boards are given out - RTTR_EXEC_TILL(500,HQ->GetInventory()[GoodType::Boards] < 10); + RTTR_EXEC_TILL(200,HQ->GetInventory()[GoodType::Boards] < 10); //check if building where found - RTTR_EXEC_TILL(10000,world.GetNO(posWoodcutter)->GetType() == NodalObjectType::Building); - RTTR_EXEC_TILL(10000,world.GetNO(posSawmill)->GetType() == NodalObjectType::Building); + RTTR_EXEC_TILL(2000,world.GetNO(posWoodcutter)->GetType() == NodalObjectType::Building); + RTTR_EXEC_TILL(2000,world.GetNO(posSawmill)->GetType() == NodalObjectType::Building); } BOOST_FIXTURE_TEST_CASE(EmergencyProtoclActiveOtherBuldingsnotBuild, EmergencyFixture) @@ -83,7 +81,7 @@ BOOST_FIXTURE_TEST_CASE(EmergencyProtoclActiveOtherBuldingsnotBuild, EmergencyFi std::vector(2, Direction::NorthEast)); //wait for some more ticks to give time if not working to deliver more boards - RTTR_SKIP_GFS(200); + RTTR_SKIP_GFS(500); //check boards are still fine and protocol working BOOST_TEST_CHECK(world.GetPlayer(0).GetHQ()->GetInventory()[GoodType::Boards] == 10); } From 0c79309a84adb05d6eeeb40073a390b4b5cbdf7f Mon Sep 17 00:00:00 2001 From: lukas Date: Sat, 18 Jul 2026 14:31:50 +0200 Subject: [PATCH 9/9] formated test file --- .../integration/testEmergencyProtocol.cpp | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/s25Main/integration/testEmergencyProtocol.cpp b/tests/s25Main/integration/testEmergencyProtocol.cpp index d5b2161255..f8f419d311 100644 --- a/tests/s25Main/integration/testEmergencyProtocol.cpp +++ b/tests/s25Main/integration/testEmergencyProtocol.cpp @@ -15,12 +15,12 @@ #include "worldFixtures/initGameRNG.hpp" #include "gameTypes/GO_Type.h" #include -#include #include +#include struct EmergencyFixture : public WorldFixture { - nobHQ * HQ = world.GetPlayer(0).GetHQ(); + nobHQ* HQ = world.GetPlayer(0).GetHQ(); EmergencyFixture() { HQ->AddToInventory(HQ->getStartInventory(StartWares::VLow), true); @@ -30,21 +30,21 @@ struct EmergencyFixture : public WorldFixture world.SetBuildingSite(BuildingType::Farm, pos, 0); world.BuildRoad(0, false, world.GetNeighbour(pos, Direction::SouthEast), std::vector(3, Direction::West)); - + pos = world.GetPlayer(0).GetHQPos() + MapPoint(-3, 0); world.SetBuildingSite(BuildingType::Farm, pos, 0); world.BuildRoad(0, false, world.GetNeighbour(pos, Direction::SouthEast), std::vector(3, Direction::East)); - //wait until emergency protocol should be activated - RTTR_EXEC_TILL(500,HQ->GetInventory()[GoodType::Boards] == 10); + // wait until emergency protocol should be activated + RTTR_EXEC_TILL(500, HQ->GetInventory()[GoodType::Boards] == 10); - //activate program (with 10 boards it should trigger) + // activate program (with 10 boards it should trigger) world.GetPlayer(0).TestForEmergencyProgramm(); - //wait for some more ticks to give time if not working to deliver more boards + // wait for some more ticks to give time if not working to deliver more boards RTTR_SKIP_GFS(200); - //check boards are still fine and protocol working + // check boards are still fine and protocol working BOOST_TEST_CHECK(world.GetPlayer(0).GetHQ()->GetInventory()[GoodType::Boards] == 10); } }; @@ -63,12 +63,12 @@ BOOST_FIXTURE_TEST_CASE(EmergencyProtoclActiveWoodcutterAndSawmillCanBuild, Emer world.BuildRoad(0, false, world.GetNeighbour(posSawmill, Direction::SouthEast), std::vector(2, Direction::NorthEast)); - //check if inventory boards are given out - RTTR_EXEC_TILL(200,HQ->GetInventory()[GoodType::Boards] < 10); + // check if inventory boards are given out + RTTR_EXEC_TILL(200, HQ->GetInventory()[GoodType::Boards] < 10); - //check if building where found - RTTR_EXEC_TILL(2000,world.GetNO(posWoodcutter)->GetType() == NodalObjectType::Building); - RTTR_EXEC_TILL(2000,world.GetNO(posSawmill)->GetType() == NodalObjectType::Building); + // check if building where found + RTTR_EXEC_TILL(2000, world.GetNO(posWoodcutter)->GetType() == NodalObjectType::Building); + RTTR_EXEC_TILL(2000, world.GetNO(posSawmill)->GetType() == NodalObjectType::Building); } BOOST_FIXTURE_TEST_CASE(EmergencyProtoclActiveOtherBuldingsnotBuild, EmergencyFixture) @@ -80,8 +80,8 @@ BOOST_FIXTURE_TEST_CASE(EmergencyProtoclActiveOtherBuldingsnotBuild, EmergencyFi world.BuildRoad(0, false, world.GetNeighbour(pos, Direction::SouthEast), std::vector(2, Direction::NorthEast)); - //wait for some more ticks to give time if not working to deliver more boards + // wait for some more ticks to give time if not working to deliver more boards RTTR_SKIP_GFS(500); - //check boards are still fine and protocol working + // check boards are still fine and protocol working BOOST_TEST_CHECK(world.GetPlayer(0).GetHQ()->GetInventory()[GoodType::Boards] == 10); }