1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-05-21 22:33:43 +02:00

582 Commits

Author SHA1 Message Date
Ivan Savenko
2c17c2d5b7 Rework CCallback <-> CClient interaction
- callback is now part of lib instead of weird class that is shared by
client and AI while being part of client
- callback interacts with client class via minimal interface class
- removed no longer used unlockGsWhileWaiting field
2025-05-12 22:07:10 +03:00
Ivan Savenko
35644da2b7 Reogranize callback-related classes on 1 file = 1 class basis 2025-05-12 22:07:09 +03:00
Ivan Savenko
283adc37d7 Unit stack rebalancing rework
- CStackInstance::count is now private with accessor methods
- CStackInstance::experience renamed to totalExperience and now stores
total stack experience (multiplied by stack size) to reduce rounding
errors
- CStackInstance::totalExperience is now private with accessors methods
- stack experience is now automatically reallocated on stack management
- Removed buggy BulkSmartRebalanceStacks pack, that mostly duplicates
BulkRebalanceStacks
- Renamed BulkSmartSplitStack to BulkSplitAndRebalanceStack to drop
unclear "smart" in name
- Reworked split-and-rebalance logic to correctly reallocate stack
experience
2025-05-01 18:18:30 +03:00
Ivan Savenko
f70ad2c15b Reorganized artifact-related classes
- files now generally contain only 1 class (except for tightly coupled
classes)
- files are now located in lib/entities/artifact directory
- removed excessive includes

No changes to functionality
2025-04-29 13:29:08 +03:00
Ivan Savenko
829739da24 Reduce usage of implicit conversions to int 2025-04-27 14:57:31 +03:00
Ivan Savenko
4d57a8ed36 Prefer to pass CGameState as reference instead of pointer 2025-04-27 14:57:31 +03:00
Ivan Savenko
93b18ee94b Fix some issues detected by Sonar & code review, fix build 2025-04-27 14:57:31 +03:00
Ivan Savenko
d34b47bb20 Remove pointers from artifacts 2025-04-27 14:57:31 +03:00
Ivan Savenko
9e6397d1f9 Remove pointer to boat from CGHeroInstance 2025-04-27 14:57:30 +03:00
Ivan Savenko
cd7732456a Remove pointer to objects from TerrainTile 2025-04-27 14:57:30 +03:00
Ivan Savenko
63d00b080e Removed pointer to army from StackInstance 2025-04-27 14:57:30 +03:00
Ivan Savenko
16a06179cf Use ArtifactInstanceID in CGArtifact 2025-04-27 14:57:30 +03:00
Ivan Savenko
ab11d2b075 Remove quests from CMap, now solely owned by quest objects 2025-04-27 14:57:30 +03:00
Ivan Savenko
c02a8a84fd Stacks of armed instance are now unique_ptr 2025-04-27 14:57:30 +03:00
Ivan Savenko
797646cc05 Quests in map now use shared_ptr instead of const ptr 2025-04-27 14:57:30 +03:00
Ivan Savenko
417ea6451a Remove ConstTransitivePtr from hero and town instances 2025-04-27 14:57:30 +03:00
Ivan Savenko
96d691b40c Fix crash on closing game during background image upscaling 2025-03-12 14:18:44 +00:00
Ivan Savenko
dff37ce81f Fix freeze if AI initiates large number of async requests during turn 2025-03-11 14:58:26 +00:00
Ivan Savenko
4a6a8f9496
Merge pull request #5496 from IvanSavenko/std_thread
Replace boost::thread with std::thread
2025-03-08 16:03:55 +02:00
Ivan Savenko
9f713a0914 Rename int3::valid to isValid for consistency 2025-03-03 10:46:00 +00:00
Ivan Savenko
0200e871c3 Code cleanup 2025-03-02 20:39:41 +00:00
Ivan Savenko
a31788b874 Replace thread spawning with tbb pool for adventure AI 2025-03-02 19:24:24 +00:00
Ivan Savenko
948abfb04c AI now uses std::thread, added custom thread interruption logic 2025-03-02 14:33:11 +00:00
Ivan Savenko
a8a6be7ac1 Fix potential compatibility with C++20 / C++23 mode
This fixes several issues with compatibility with C++20. C++23 was also
tested, but apparently it does not have any additional breaking changes
compared to C++20 (or we don't have those).

VCMI still uses C++17 as before - goal is only to make potential
transition easier.

There were 2 cases that are deprecated in C++20 that we use:
- Floating point operations on enums are deprecated
- `this` can no longer be captured when using default capture by value
`[=]`

Both of those should now be replaced with code that works fine in both C+
+17 and in C++20 mode
2025-03-02 14:11:48 +00:00
Laserlicht
0182bcd74a Revert "min_element and max_element from std"
This reverts commit ba2d8dc2768b59e07c862d4eada2b9d5c974b060.
2025-02-28 17:04:37 +01:00
Laserlicht
a8b9ec9d67 Revert "std::sort instead of boost::sort"
This reverts commit 2f8566b63ead5309bb1eb7407432200f2e0c9e55.
2025-02-28 17:04:06 +01:00
Laserlicht
ba2d8dc276 min_element and max_element from std 2025-02-28 16:56:20 +01:00
Laserlicht
2f8566b63e std::sort instead of boost::sort 2025-02-28 16:47:35 +01:00
Laserlicht
75a95d8513 boost::lock_guard replace 2025-02-28 15:28:38 +01:00
Laserlicht
7dfb499edf replace boost locks with std 2025-02-28 15:25:58 +01:00
Ivan Savenko
645b95ba02 Renamed LibClasses * VLC to GameLibrary * LIBRARY 2025-02-21 16:54:56 +00:00
Ivan Savenko
32391dc7a9 Pathfinder cache is now stored separately per playerBlocked
- human player will now use pathfinder settings from config (as before)
- nullkiller AI will now use its own, modified settings
- added option to configure NKAI usage of monolith to config
- fixed pathfinder costs not updating on receiving levelup
2025-01-23 15:28:44 +00:00
MichalZr6
f893c80192 Move UpgradeInfo class to header and source files 2024-12-19 14:13:09 +01:00
MichalZr6
af9445c16f Fixes following review 2024-12-17 22:34:06 +01:00
MichalZr6
d8d3948ac3 Fix AI to use hillFort all available upgrades. UpgradeInfo refactor. 2024-12-17 22:34:06 +01:00
Ivan Savenko
be2327d000 Removed no longer used or redundant constants 2024-11-28 12:11:13 +00:00
Ivan Savenko
56ee307b3a Extend AI garrison troop removal logic to all RoE campaigns to emulate
H3 logic
2024-11-17 17:38:54 +00:00
Ivan Savenko
d3af9f1c67 Removed pointer to VLC entity from CStackBasicDescriptor 2024-10-30 16:47:02 +00:00
Ivan Savenko
c98ac01e7a Replaced public artType member of ArtifactInstance with getter 2024-10-30 16:47:01 +00:00
Ivan Savenko
10ad0fc760 Split CHeroHandler.cpp/.h into 1 file per class
All parts of CHeroHandler.cpp are now in lib/entities/hero
Adjusted includes to use new paths
No functionality changes
2024-10-13 14:01:09 +00:00
Ivan Savenko
3dd4fa2528 Reduce usage of pointers to VLC entities
Final goal (of multiple PR's) is to remove all remaining pointers from
serializeable game state, and replace them with either identifiers or
with shared/unique pointers.

CGTownInstance::town and CGHeroInstance::type members have been removed.
Now this data is computed dynamically using subID member.

VLC entity of a town can now be accessed via following methods:
- getFactionID() returns ID of a faction
- getFaction() returns pointer to a faction
- getTown() returns pointer to a town

VLC entity of a hero can now be accessed via following methods:
- getHeroTypeID() returns ID of a hero
- getHeroClassID() returns ID of a hero class
- getHeroType() returns pointer to a hero
- getHeroClass() returns pointer to a hero class
2024-10-10 12:28:08 +00:00
Ivan Savenko
a8f8c3f4b1 Replaced most of accesses to CGObjectInstance::pos with anchorPoint() 2024-10-09 15:43:46 +00:00
Ivan Savenko
503b87561e Converted all h3 banks to rewardable, remove most of hardcoded checks 2024-09-12 12:11:18 +00:00
Ivan Savenko
8225eb454e Added GameSettings to gamestate, potentially allowing to define game
settings per map (or in random map template)
2024-09-05 15:16:27 +00:00
Ivan Savenko
01396b62b7 Extracted handling of type ID's from serializer into a separate class 2024-08-26 19:48:46 +00:00
Ivan Savenko
b84af1a6de Significantly simplify packs applying
Apparently our logic for packs applying with types registration is
overcomplicated and by now completely unnecessary - it became redundant
after introduction of visitor pattern.
2024-08-26 19:48:46 +00:00
SoundSSGood
2e3e6b1553 market->getObjInstanceID() 2024-08-21 01:01:23 +03:00
SoundSSGood
58bb2b58e3 IMarket suggestions
Co-authored-by: Ivan Savenko <saven.ivan@gmail.com>
2024-08-20 18:49:48 +03:00
SoundSSGood
fd45b5144d IMarket serializeable 2024-08-20 18:49:47 +03:00
Ivan Savenko
2a05fbdd50 Unified handling of battle sides ID's
- Replaced BattleSide namespace-enum with enum class
- Merged two different BattleSide enum's into one
- Merged BattlePerspective enum into BattleSide enum
- Changed all places that use integers to represent battle side to use
BattleSide enum
- Added BattleSideArray convenience wrapper for std::array that is
always 2-elements in size and allows access to its elements using
BattleSide enum
2024-08-11 20:54:44 +00:00