-
Notifications
You must be signed in to change notification settings - Fork 95
Configurable mine resource behavior #1942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
DevOpsOfChaos
wants to merge
14
commits into
Return-To-The-Roots:master
Choose a base branch
from
DevOpsOfChaos:sidequest/configurable-mine-resource-behavior
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ea2ee5f
Fix inexhaustible granite mine production
DevOpsOfChaos b887aaf
Simplify granite mine resource handling
DevOpsOfChaos 4e4b9d1
Tighten granite mine production tests
DevOpsOfChaos b636b5d
Clarify inexhaustible granite mines addon description
DevOpsOfChaos 2a4936e
Avoid runtime addon toggle in granite mine test
DevOpsOfChaos fb40fc9
Split granite mine work-everywhere addon
DevOpsOfChaos 44bbab0
Implement configurable mine resource behavior
DevOpsOfChaos 64a8b71
Implement mine no-output fallback behavior
DevOpsOfChaos 621d52e
Teach AI mine planning configurable resource behavior
DevOpsOfChaos d1df485
Adjust mine productivity display for S4-like behavior
DevOpsOfChaos 1733b37
Merge branch 'master' into sidequest/configurable-mine-resource-behavior
DevOpsOfChaos b9be39f
Merge branch 'master' into sidequest/configurable-mine-resource-behavior
DevOpsOfChaos bf24106
Rework configurable mine resource behavior
DevOpsOfChaos 86587eb
Clarify S4-like mine productivity reference
DevOpsOfChaos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,11 @@ | |
| #include "mygettext/mygettext.h" | ||
|
|
||
| /** | ||
| * Addon for allowing to have unlimited resources. | ||
| * Deprecated global mine setting. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add |
||
| * | ||
| * Not registered anymore. The ID is still decoded when loading old | ||
| * settings/savegames and migrated to the per-mine | ||
| * resource behavior settings. | ||
| */ | ||
| class AddonInexhaustibleMines : public AddonBool | ||
| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // Copyright (C) 2005 - 2026 Settlers Freaks (sf-team at siedler25.org) | ||
| // | ||
| // SPDX-License-Identifier: GPL-2.0-or-later | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "AddonList.h" | ||
| #include "const_addons.h" | ||
| #include "mygettext/mygettext.h" | ||
| #include "gameTypes/MineNoOutputFallback.h" | ||
|
|
||
| class AddonMineNoOutputFallback : public AddonList | ||
| { | ||
| public: | ||
| AddonMineNoOutputFallback() | ||
| : AddonList(AddonId::MINE_NO_OUTPUT_FALLBACK, AddonGroup::Economy, _("Mine No-Output Fallback"), | ||
| _("Configures what mines produce when S4-like exhaustion would produce nothing."), | ||
| {_("Produce nothing"), _("Produce granite 25%"), _("Produce granite 50%"), | ||
| _("Produce granite 100%"), _("Produce lower grade resource")}, | ||
| static_cast<unsigned>(MineNoOutputFallback::ProduceNothing)) | ||
| {} | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // Copyright (C) 2005 - 2026 Settlers Freaks (sf-team at siedler25.org) | ||
| // | ||
| // SPDX-License-Identifier: GPL-2.0-or-later | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "AddonList.h" | ||
| #include "const_addons.h" | ||
| #include "mygettext/mygettext.h" | ||
| #include "gameTypes/MineResourceBehavior.h" | ||
| #include <string> | ||
|
|
||
| class AddonMineResourceBehaviorBase : public AddonList | ||
| { | ||
| protected: | ||
| AddonMineResourceBehaviorBase(AddonId id, const std::string& name, const std::string& description) | ||
| : AddonList(id, AddonGroup::Economy, name, description, | ||
| {_("Default"), _("Inexhaustible"), _("S4-like exhaustion"), _("Work everywhere")}, | ||
| static_cast<unsigned>(MineResourceBehavior::Default)) | ||
| {} | ||
| }; | ||
|
|
||
| class AddonCoalMineResourceBehavior : public AddonMineResourceBehaviorBase | ||
| { | ||
| public: | ||
| AddonCoalMineResourceBehavior() | ||
| : AddonMineResourceBehaviorBase(AddonId::COALMINE_RESOURCE_BEHAVIOR, _("Coal Mine Resource Behavior"), | ||
| _("Configures how coal mines consume and exhaust coal deposits.")) | ||
| {} | ||
| }; | ||
|
|
||
| class AddonIronMineResourceBehavior : public AddonMineResourceBehaviorBase | ||
| { | ||
| public: | ||
| AddonIronMineResourceBehavior() | ||
| : AddonMineResourceBehaviorBase(AddonId::IRONMINE_RESOURCE_BEHAVIOR, _("Iron Mine Resource Behavior"), | ||
| _("Configures how iron mines consume and exhaust iron deposits.")) | ||
| {} | ||
| }; | ||
|
|
||
| class AddonGoldMineResourceBehavior : public AddonMineResourceBehaviorBase | ||
| { | ||
| public: | ||
| AddonGoldMineResourceBehavior() | ||
| : AddonMineResourceBehaviorBase(AddonId::GOLDMINE_RESOURCE_BEHAVIOR, _("Gold Mine Resource Behavior"), | ||
| _("Configures how gold mines consume and exhaust gold deposits.")) | ||
| {} | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -38,6 +38,7 @@ | |||||
| // | ||||||
| // Add the #include for your AddonXXX.h in Addons.h! | ||||||
| // | ||||||
| // TODO: INEXHAUSTIBLE_MINES is kept only for loading old settings/savegames until the gamedata version can be raised. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ENUM_WITH_STRING(AddonId, LIMIT_CATAPULTS = 0x00000000, INEXHAUSTIBLE_MINES = 0x00000001, REFUND_MATERIALS = 0x00000002, | ||||||
| EXHAUSTIBLE_WATER = 0x00000003, REFUND_ON_EMERGENCY = 0x00000004, MANUAL_ROAD_ENLARGEMENT = 0x00000005, | ||||||
| CATAPULT_GRAPHICS = 0x00000006, METALWORKSBEHAVIORONZERO = 0x00000007, | ||||||
|
|
@@ -57,7 +58,9 @@ ENUM_WITH_STRING(AddonId, LIMIT_CATAPULTS = 0x00000000, INEXHAUSTIBLE_MINES = 0x | |||||
|
|
||||||
| MILITARY_AID = 0x00700000, | ||||||
|
|
||||||
| INEXHAUSTIBLE_GRANITEMINES = 0x00800000, | ||||||
| INEXHAUSTIBLE_GRANITEMINES = 0x00800000, COALMINE_RESOURCE_BEHAVIOR = 0x00800001, | ||||||
| IRONMINE_RESOURCE_BEHAVIOR = 0x00800002, GOLDMINE_RESOURCE_BEHAVIOR = 0x00800003, | ||||||
| MINE_NO_OUTPUT_FALLBACK = 0x00800004, | ||||||
|
|
||||||
| MAX_RANK = 0x00900000, SEA_ATTACK = 0x00900001, INEXHAUSTIBLE_FISH = 0x00900002, | ||||||
| MORE_ANIMALS = 0x00900003, BURN_DURATION = 0x00900004, NO_ALLIED_PUSH = 0x00900005, | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this class to the other ones to avoid missing it. And you can rename the addon id to match the new ones if you keep the value.