-
Notifications
You must be signed in to change notification settings - Fork 93
Add leather addon #1720
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
Merged
Merged
Add leather addon #1720
Changes from all commits
Commits
Show all changes
101 commits
Select commit
Hold shift + click to select a range
b5e17f3
Adding ware workflow, buildings and menus for leather addon
ottml 88e1bd7
Add distribution tab for ham and make gui more general
ottml ec2096f
Add compatibilty code
ottml 449b3fa
Add direct transport route
ottml 822aa6e
Add fixed animations from leather_bobs.lst
ottml 458618e
Skinner goes out to get skins from carcass if he has no pigs (natural…
ottml 8c3e36e
LeatherAddon military (1): Add SetArmorAllowed game command
ottml b95015b
LeatherAddon military (2): Add logic for armor in military building a…
ottml c7715bf
LeatherAddon military (3): Add armor gui elements to military building
ottml f1b95b4
Add test for SetArmorAllowed
ottml ed1a46d
Add compatibility code for ChangeDistribution and increase game comma…
ottml 1c4f1f2
Add new transportation type leatherworking and compatibility code for…
ottml 4ae991e
Fix wrong default build order
ottml f5e35dc
Solider has 30 percent chance to not die if he has an armor and is hi…
ottml dd39167
Reduce search range for skinner to hunter distance
ottml 698c44e
Do not show tabs for goods in distribution gui having only one entry
ottml 0610145
Add correct default values
ottml f94a9db
Fix build after rebase
ottml 41baf5b
Add new base class for armored people
ottml a1b2655
Use same render code for fighting and armored people
ottml 3812224
Add armor base class to trade donkey too
ottml 139279c
Add armored soldiers to inventory and add enums for it
ottml 11070d4
Add logic for counting armored soldiers in inventory and compatibilit…
ottml 29ea0fb
Add and remove armored soldiers to global inventory add missing adds …
ottml e8d49e8
Add tooltip to inventory to show number of armored soldiers
ottml 4bbb0de
Show amored soldiers on ship (debug only)
ottml 639dbea
Avoid crash in sorted container
ottml 28b9fba
Adjust comperators to take armor into account
ottml 7730abd
Avoid crash/inconsisent state due to new comperator including armor
ottml 844bb74
Fix formatting
ottml f912e8b
Handle real inventory correct (Part 1)
ottml 77c04f1
Fix formatting and constexpr
ottml 31289fb
Handle real inventory correct (Part 1)
ottml d6e0c13
Add armored soldiers to reserve
ottml 2131552
Add real for orderJob
ottml a30024b
Use correct lst file (seems to be broken due to fixup from git)
ottml 76c44a8
Handle armor correct when building is destroyed or captured and when …
ottml 5fa0f89
Add and remove armored figures correct to visual inventory
ottml ccee3a0
Remove code duplication and draw +1 only if HITPOINTS addon is activa…
ottml 3568c7e
Add addons to disable armor by default and behaviour for armor delive…
ottml eea8103
Add function to avoid code duplication
ottml 9896a6c
Fix clang-tidy warnings
ottml c23a3da
Add test for trading and warehouse
ottml af6ee4c
Add test for soldier losing armor in fight instead of hitpoint
ottml 6da0aee
Add replay compatibility for ChangeBuildOrder and SetAllInventorySett…
ottml 0d4892c
Add comment about GC changes
ottml 2881baa
Fix circular dependency during deserialization
ottml 6ee5628
Increase minor replay version to be able to set the correct initial d…
ottml d89f4a7
Code review
ottml 57d433c
Code review: Improve unit test
ottml 4d63bed
Code review: Move addon check functions for unused Ware/Jobs/Building…
ottml a1ce1b5
Code review: Inline functions
ottml cc14185
Code review: Use CamelCase and rename enum class
ottml 6976123
Code review: Rename IsArmorDisabled to IsArmorAllowed
ottml 5cc7877
Code review: Use consistent cast and parse argument as reference. Rem…
ottml 07f90dc
Code review: Remove Invalid state from enum and throw exception when …
ottml f65a0ce
Code review: Rename functions, remove auto return type and capture ad…
ottml a27bdd6
Code review: Add named constants for deserialization code for better …
ottml af7a7ab
Code review: Use checkedCast
ottml 2c57be8
Code review: Rewrite test and fold 4 cases into one
ottml 614d5a7
Code review: Use switch
ottml 6b83bbd
Code review: Rename variables and change type
ottml 103bd80
Code review: Use constants and rewrite counting of traded soldiers
ottml 31c6599
Code review
ottml eae56d2
Code review: Use clearer names for varibles
ottml f48d4d6
Code review: Optimize code
ottml 8d9cd2a
Code review: Use better function names and remove german comment
ottml f812c3c
Code review: Check for production disabled and use radius instead of …
ottml e056a56
Code review: Use extra enum for armor icon above soldier
ottml 6e21152
Code review: Use better function names and remove german comment
ottml 76e51eb
Code review use operator instead of member
ottml ce21e2f
Code review: Add comment to explain scenario
ottml faa5840
Code review: Handle GoodType::Nothing in save games
ottml 21095f1
Code review: Add comment to clarify no OBB write appears
ottml 93a3aae
Code review: Fix wrong index
ottml 40ebbd2
Code review: Split a PeopleArray from GoodsAndPeopleArray and let the…
ottml be50c50
Code review: Revert changed parameter name
ottml 877a264
Code review: Cleanup header and remove using instead of direct type
ottml 4fabff0
Code review: Hunter and skinner have same behaviour. Time for hunter …
ottml be875a5
Code review: Add check to avoid assert
ottml c58a180
Code review: Add comment about ownership of animal for skinner and hu…
ottml b683cc4
Code review: Apply patch to remove nofArmored base class not needed a…
ottml 9941395
Code review add comment
ottml 84c6218
Fix after rebase
ottml dbc0ad9
Code review: Fix formatting
ottml d5d0bfd
Code review:
ottml 5656c38
Code review: Use access functions instead of direct member access
ottml e729256
Code review: Revert asserts for Add/Remove armored soldier
ottml 243835f
Code review: Change info text
ottml 27b05be
Code review: Inline function
ottml c9e213a
Code review: Use access functions instead of direct member access
ottml 4d37057
Code review: Remove write operator[] for armoredSoldier and use direc…
ottml 2013b39
Code review: Use container for Serialize/Deserialize
ottml b6655ec
Fix crash
ottml a275f15
Code review: style issues and nitpicks
ottml af34dd6
Update libs/s25main/buildings/nobMilitary.cpp
ottml 2f74b46
Code review: Add path optimization. See #1785
ottml 773f137
Unify `FindClientForCoin` with `FindClientForArmor`
Flamefire 74e4563
Sort possible clients of coins/armor by estimated priority
Flamefire 0495f38
Revert "Sort possible clients of coins/armor by estimated priority"
Flamefire 3adeb1f
Merge branch 'master' into leather_addon
Flamefire 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,57 @@ | ||
| // Copyright (C) 2005 - 2025 Settlers Freaks (sf-team at siedler25.org) | ||
| // | ||
| // SPDX-License-Identifier: GPL-2.0-or-later | ||
|
|
||
| #include "AddonHelperFunctions.h" | ||
| #include "GlobalGameSettings.h" | ||
| #include <LeatherLoader.h> | ||
| #include <WineLoader.h> | ||
| #include <addons/Addon.h> | ||
|
|
||
| std::function<bool(const BuildingType type)> makeIsUnusedBuilding(const GlobalGameSettings& ggs) | ||
| { | ||
| const bool wineAddonActive = ggs.isEnabled(AddonId::WINE); | ||
| const bool charburnerAddonActive = ggs.isEnabled(AddonId::CHARBURNER); | ||
| const bool leatherAddonActive = ggs.isEnabled(AddonId::LEATHER); | ||
|
|
||
| return [wineAddonActive, charburnerAddonActive, leatherAddonActive](BuildingType const& bld) { | ||
| if(!wineAddonActive && wineaddon::isWineAddonBuildingType(bld)) | ||
| return true; | ||
| if(!charburnerAddonActive && bld == BuildingType::Charburner) | ||
| return true; | ||
| if(!leatherAddonActive && leatheraddon::isLeatherAddonBuildingType(bld)) | ||
| return true; | ||
| return false; | ||
| }; | ||
| } | ||
|
|
||
| std::function<bool(const GoodType type)> makeIsUnusedWare(const GlobalGameSettings& ggs) | ||
| { | ||
| const bool wineAddonActive = ggs.isEnabled(AddonId::WINE); | ||
| const bool leatherAddonActive = ggs.isEnabled(AddonId::LEATHER); | ||
|
|
||
| return [wineAddonActive, leatherAddonActive](GoodType const& type) { | ||
| if(!wineAddonActive && wineaddon::isWineAddonGoodType(type)) | ||
| return true; | ||
| if(!leatherAddonActive && leatheraddon::isLeatherAddonGoodType(type)) | ||
| return true; | ||
| return false; | ||
| }; | ||
| } | ||
|
|
||
| std::function<bool(const Job job)> makeIsUnusedJob(const GlobalGameSettings& ggs) | ||
| { | ||
| const bool wineAddonActive = ggs.isEnabled(AddonId::WINE); | ||
| const bool charburnerAddonActive = ggs.isEnabled(AddonId::CHARBURNER); | ||
| const bool leatherAddonActive = ggs.isEnabled(AddonId::LEATHER); | ||
|
|
||
| return [wineAddonActive, charburnerAddonActive, leatherAddonActive](Job const& job) { | ||
| if(!wineAddonActive && wineaddon::isWineAddonJobType(job)) | ||
| return true; | ||
| if(!charburnerAddonActive && job == Job::CharBurner) | ||
| return true; | ||
| if(!leatherAddonActive && leatheraddon::isLeatherAddonJobType(job)) | ||
| return true; | ||
| return false; | ||
| }; | ||
| } |
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,31 @@ | ||
| // Copyright (C) 2005 - 2025 Settlers Freaks (sf-team at siedler25.org) | ||
| // | ||
| // SPDX-License-Identifier: GPL-2.0-or-later | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "gameTypes/BuildingType.h" | ||
| #include "gameTypes/GoodTypes.h" | ||
| #include "gameTypes/JobTypes.h" | ||
| #include <functional> | ||
|
|
||
| class GlobalGameSettings; | ||
|
|
||
| std::function<bool(const BuildingType type)> makeIsUnusedBuilding(const GlobalGameSettings& ggs); | ||
| std::function<bool(const GoodType type)> makeIsUnusedWare(const GlobalGameSettings& ggs); | ||
| std::function<bool(const Job job)> makeIsUnusedJob(const GlobalGameSettings& ggs); | ||
|
|
||
| // Only used for deserialization, can be removed when breaking compatibility (GetGameDataVersion) | ||
| constexpr auto numLeatherAddonBuildings = 3u; | ||
| constexpr auto numWineAddonBuildings = 3u; | ||
| constexpr auto numWineAndLeatherAddonBuildings = numWineAddonBuildings + numLeatherAddonBuildings; | ||
|
|
||
| constexpr auto numLeatherAddonGoods = 3u; | ||
| constexpr auto numWineAddonGoods = 2u; | ||
| constexpr auto numWineAndLeatherAddonGoods = numWineAddonGoods + numLeatherAddonGoods; | ||
|
|
||
| constexpr auto numLeatherAddonJobs = 3u; | ||
| constexpr auto numWineAddonJobs = 3u; | ||
| constexpr auto numWineAndLeatherAddonJobs = numWineAddonJobs + numLeatherAddonJobs; | ||
|
|
||
| constexpr uint8_t transportPrioOfLeatherworks = 7; |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.