@@ -26,10 +26,10 @@ BOOST_AUTO_TEST_SUITE(Production)
2626namespace {
2727struct GraniteMineWithoutResourcesFixture : WorldWithGCExecution1P
2828{
29- const nobUsual* CreateGraniteMineWithoutResources ()
29+ MapPoint CreateGraniteMineWithoutResources ()
3030 {
3131 GoodsAndPeopleCounts inv;
32- inv[GoodType::Fish] = 10 ;
32+ inv[GoodType::Fish] = 40 ;
3333 inv[GoodType::PickAxe] = 1 ;
3434 inv[Job::Miner] = 1 ;
3535 world.GetSpecObj <nobBaseWarehouse>(hqPos)->AddToInventory (inv, true );
@@ -39,7 +39,7 @@ struct GraniteMineWithoutResourcesFixture : WorldWithGCExecution1P
3939 BuildingFactory::CreateBuilding (world, BuildingType::GraniteMine, minePos, curPlayer, Nation::Romans));
4040 BuildRoad (world.GetNeighbour (minePos, Direction::SouthEast), false , std::vector<Direction>(2 , Direction::West));
4141 RTTR_EXEC_TILL (500 , mine->HasWorker ());
42- return mine ;
42+ return minePos ;
4343 }
4444};
4545} // namespace
@@ -134,14 +134,50 @@ BOOST_FIXTURE_TEST_CASE(GraniteMineWithoutResourcesNeedsAddon, GraniteMineWithou
134134 BOOST_TEST (curInventory[GoodType::Stones] == initialStones);
135135}
136136
137- BOOST_FIXTURE_TEST_CASE (InexhaustibleGraniteMineWorksWithoutResources , GraniteMineWithoutResourcesFixture)
137+ BOOST_FIXTURE_TEST_CASE (InexhaustibleGraniteMineStillNeedsResourceSpot , GraniteMineWithoutResourcesFixture)
138138{
139139 ggs.setSelection (AddonId::INEXHAUSTIBLE_GRANITEMINES , 1 );
140140 CreateGraniteMineWithoutResources ();
141141 const Inventory& curInventory = world.GetPlayer (curPlayer).GetInventory ();
142142 const unsigned initialStones = curInventory[GoodType::Stones];
143143
144+ RTTR_SKIP_GFS (2000 );
145+
146+ BOOST_TEST (curInventory[GoodType::Stones] == initialStones);
147+ }
148+
149+ BOOST_FIXTURE_TEST_CASE (GraniteMineWorkEverywhereCreatesDepletableResource, GraniteMineWithoutResourcesFixture)
150+ {
151+ ggs.setSelection (AddonId::GRANITEMINES_WORK_EVERYWHERE , 1 );
152+ const MapPoint minePos = CreateGraniteMineWithoutResources ();
153+ const Inventory& curInventory = world.GetPlayer (curPlayer).GetInventory ();
154+ const unsigned initialStones = curInventory[GoodType::Stones];
155+
156+ RTTR_EXEC_TILL (2000 , curInventory[GoodType::Stones] > initialStones);
157+ BOOST_TEST (world.GetNode (minePos).resources .has (ResourceType::Granite));
158+
159+ RTTR_EXEC_TILL (50000 , world.GetNode (minePos).resources .getType () == ResourceType::Granite
160+ && world.GetNode (minePos).resources .getAmount () == 0u );
161+ BOOST_TEST (static_cast <unsigned >(world.GetNode (minePos).resources .getType ()) == static_cast <unsigned >(ResourceType::Granite));
162+ BOOST_TEST (world.GetNode (minePos).resources .getAmount () == 0u );
163+ }
164+
165+ BOOST_FIXTURE_TEST_CASE (GraniteMineWorkEverywhereResourceIsInexhaustibleWithGraniteAddon, GraniteMineWithoutResourcesFixture)
166+ {
167+ ggs.setSelection (AddonId::GRANITEMINES_WORK_EVERYWHERE , 1 );
168+ ggs.setSelection (AddonId::INEXHAUSTIBLE_GRANITEMINES , 1 );
169+ const MapPoint minePos = CreateGraniteMineWithoutResources ();
170+ const Inventory& curInventory = world.GetPlayer (curPlayer).GetInventory ();
171+ const unsigned initialStones = curInventory[GoodType::Stones];
172+
144173 RTTR_EXEC_TILL (2000 , curInventory[GoodType::Stones] > initialStones);
174+ BOOST_TEST (world.GetNode (minePos).resources .has (ResourceType::Granite));
175+ const unsigned initialResourceAmount = world.GetNode (minePos).resources .getAmount ();
176+
177+ RTTR_SKIP_GFS (10000 );
178+
179+ BOOST_TEST (world.GetNode (minePos).resources .has (ResourceType::Granite));
180+ BOOST_TEST (world.GetNode (minePos).resources .getAmount () == initialResourceAmount);
145181}
146182
147183BOOST_AUTO_TEST_SUITE_END ()
0 commit comments