Skip to content

Fix inexhaustible granite mine production#1918

Closed
DevOpsOfChaos wants to merge 1 commit into
Return-To-The-Roots:masterfrom
DevOpsOfChaos:codex/fix-inexhaustible-granite-mines
Closed

Fix inexhaustible granite mine production#1918
DevOpsOfChaos wants to merge 1 commit into
Return-To-The-Roots:masterfrom
DevOpsOfChaos:codex/fix-inexhaustible-granite-mines

Conversation

@DevOpsOfChaos

Copy link
Copy Markdown
Contributor

Summary

  • allow granite mines to produce without a granite resource spot when INEXHAUSTIBLE_GRANITEMINES is enabled
  • keep the existing resource requirement when the addon is disabled
  • add regression coverage for both addon-disabled and addon-enabled behavior

Root cause

The addon prevented granite resource depletion, but production still required FindPointWithResource(ResourceType::Granite) to find an existing resource spot. On mountain positions without granite resources, the mine therefore never started producing even with the addon enabled.

Validation

  • Test_integration.exe --run_test=Production --report_level=short
  • ctest --test-dir C:\dev\s25client\build-vs-x64-debug -C Debug --output-on-failure

Fixes #918

Comment thread libs/s25main/figures/nofMiner.cpp

@Flamefire Flamefire left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
How much of that was created by AI? Just curious

In #918 we discussed that the description of the addon would need adjustment as with this change stone mines are not (only) inexhaustible but don't need (explicit) stone resource in the first place and hence could be build anywhere on the mountain, even on e.g. gold or coal deposits
Can you (or Codex) come up with a slightly changed description to avoid confusion of that?


BOOST_FIXTURE_TEST_CASE(InexhaustibleGraniteMineWorksWithoutResources, WorldWithGCExecution1P)
{
ggs.setSelection(AddonId::INEXHAUSTIBLE_GRANITEMINES, 1);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those 2 tests have the same setup, which I'd like to keep in sync and clearly the same.

I see 2 ways:

  1. Move the common code to a fixture
  2. Change the setting of INEXHAUSTIBLE_GRANITEMINES in the test

I'm concerned by a (purely theoretical though) difference:

-    RTTR_EXEC_TILL(500, mine->HasWorker());
-    RTTR_SKIP_GFS(2000);
+    RTTR_EXEC_TILL(3000, curInventory[GoodType::Stones] > initialStones);

In 2nd case

  • You don't wait for the worker to arrive
  • Time is longer. So it could (theoretically) be possible that after 2501 GFs a stone would arrive making the test wrongly pass

The name GraniteMineWithoutResourcesNeedsAddon would be a great fit for the 2nd approach: Addon disable: No stone, enabling it yields stone being produced.

Currently not sure if the logic of when the worker starts (trying) to work again works with that though in which case the fixture needs to be used.

What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

70/30 AI i' use RTTR since 2024. now i'am more familiar with programming due to ai,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will check on that later.

@DevOpsOfChaos
DevOpsOfChaos marked this pull request as ready for review May 1, 2026 10:43
@DevOpsOfChaos
DevOpsOfChaos deleted the codex/fix-inexhaustible-granite-mines branch May 1, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inexhaustible granite mines broken

2 participants