1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

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
This commit is contained in:
Ivan Savenko
2025-05-01 13:41:48 +03:00
parent ac26b3ed9b
commit 283adc37d7
52 changed files with 339 additions and 328 deletions

View File

@@ -36,8 +36,9 @@ enum class ESerializationVersion : int32_t
MAP_HEADER_DISPOSED_HEROES, // map header contains disposed heroes list
NO_RAW_POINTERS_IN_SERIALIZER, // large rework that removed all non-owning pointers from serializer
STACK_INSTANCE_EXPERIENCE_FIX, // stack experience is stored as total, not as average
CURRENT = NO_RAW_POINTERS_IN_SERIALIZER,
CURRENT = STACK_INSTANCE_EXPERIENCE_FIX,
};
static_assert(ESerializationVersion::MINIMAL <= ESerializationVersion::CURRENT, "Invalid serialization version definition!");

View File

@@ -226,7 +226,6 @@ void registerTypes(Serializer &s)
s.template registerType<BulkMoveArtifacts>(173);
s.template registerType<PlayerMessageClient>(174);
s.template registerType<BulkRebalanceStacks>(175);
s.template registerType<BulkSmartRebalanceStacks>(176);
s.template registerType<SetRewardableConfiguration>(177);
s.template registerType<CPackForServer>(179);
s.template registerType<EndTurn>(180);
@@ -255,7 +254,7 @@ void registerTypes(Serializer &s)
s.template registerType<PlayerMessage>(203);
s.template registerType<BulkSplitStack>(204);
s.template registerType<BulkMergeStacks>(205);
s.template registerType<BulkSmartSplitStack>(206);
s.template registerType<BulkSplitAndRebalanceStack>(206);
s.template registerType<BulkMoveArmy>(207);
s.template registerType<BulkExchangeArtifacts>(208);
s.template registerType<ManageBackpackArtifacts>(209);