From 4e927d6417d53b24d3a4a2f559f5a65777902141 Mon Sep 17 00:00:00 2001 From: Dydzio Date: Wed, 7 Feb 2024 21:57:25 +0100 Subject: [PATCH 1/3] Fix missing gold component in "join for money" dialog --- lib/mapObjects/CGCreature.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/mapObjects/CGCreature.cpp b/lib/mapObjects/CGCreature.cpp index 40edde0ca..aaf0b3b8c 100644 --- a/lib/mapObjects/CGCreature.cpp +++ b/lib/mapObjects/CGCreature.cpp @@ -171,6 +171,7 @@ void CGCreature::onHeroVisit( const CGHeroInstance * h ) const //ask if player agrees to pay gold BlockingDialog ynd(true,false); ynd.player = h->tempOwner; + ynd.components.emplace_back(ComponentType::RESOURCE, GameResID(GameResID::GOLD), action); std::string tmp = VLC->generaltexth->advobtxt[90]; boost::algorithm::replace_first(tmp, "%d", std::to_string(getStackCount(SlotID(0)))); boost::algorithm::replace_first(tmp, "%d", std::to_string(action)); From 96b18b1b8e841bd4f3697e494be68e48a5684ccb Mon Sep 17 00:00:00 2001 From: Dydzio Date: Sun, 24 Mar 2024 20:19:14 +0100 Subject: [PATCH 2/3] Fix possibilities to get outdated movement points info due to creature types --- client/NetPacksClient.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/NetPacksClient.cpp b/client/NetPacksClient.cpp index 2d9e89eaf..b0ebf0263 100644 --- a/client/NetPacksClient.cpp +++ b/client/NetPacksClient.cpp @@ -228,6 +228,7 @@ void ApplyClientNetPackVisitor::visitSetStackType(SetStackType & pack) void ApplyClientNetPackVisitor::visitEraseStack(EraseStack & pack) { dispatchGarrisonChange(cl, pack.army, ObjectInstanceID()); + cl.invalidatePaths(); //it is possible to remove last non-native unit for current terrain and lose movement penalty } void ApplyClientNetPackVisitor::visitSwapStacks(SwapStacks & pack) @@ -243,6 +244,9 @@ void ApplyClientNetPackVisitor::visitInsertNewStack(InsertNewStack & pack) void ApplyClientNetPackVisitor::visitRebalanceStacks(RebalanceStacks & pack) { dispatchGarrisonChange(cl, pack.srcArmy, pack.dstArmy); + + if(pack.srcArmy != pack.dstArmy) + cl.invalidatePaths(); // adding/removing units may change terrain type penalty based on creature native terrains } void ApplyClientNetPackVisitor::visitBulkRebalanceStacks(BulkRebalanceStacks & pack) @@ -253,6 +257,9 @@ void ApplyClientNetPackVisitor::visitBulkRebalanceStacks(BulkRebalanceStacks & p ? ObjectInstanceID() : pack.moves[0].dstArmy; dispatchGarrisonChange(cl, pack.moves[0].srcArmy, destArmy); + + if(pack.moves[0].srcArmy != destArmy) + cl.invalidatePaths(); // adding/removing units may change terrain type penalty based on creature native terrains } } From cfe7a3cfa60cec6457e42db17977f8691374a7a5 Mon Sep 17 00:00:00 2001 From: Dydzio Date: Wed, 27 Mar 2024 21:17:21 +0100 Subject: [PATCH 3/3] Fix some more cases of missing pathfinder cache invalidation --- client/NetPacksClient.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/client/NetPacksClient.cpp b/client/NetPacksClient.cpp index b0ebf0263..4ec1114c8 100644 --- a/client/NetPacksClient.cpp +++ b/client/NetPacksClient.cpp @@ -228,25 +228,31 @@ void ApplyClientNetPackVisitor::visitSetStackType(SetStackType & pack) void ApplyClientNetPackVisitor::visitEraseStack(EraseStack & pack) { dispatchGarrisonChange(cl, pack.army, ObjectInstanceID()); - cl.invalidatePaths(); //it is possible to remove last non-native unit for current terrain and lose movement penalty + cl.invalidatePaths(); //it is possible to remove last non-native unit for current terrain and lose movement penalty } void ApplyClientNetPackVisitor::visitSwapStacks(SwapStacks & pack) { dispatchGarrisonChange(cl, pack.srcArmy, pack.dstArmy); + + if(pack.srcArmy != pack.dstArmy) + cl.invalidatePaths(); // adding/removing units may change terrain type penalty based on creature native terrains } void ApplyClientNetPackVisitor::visitInsertNewStack(InsertNewStack & pack) { dispatchGarrisonChange(cl, pack.army, ObjectInstanceID()); + + if(gs.getHero(pack.army)) + cl.invalidatePaths(); // adding/removing units may change terrain type penalty based on creature native terrains } void ApplyClientNetPackVisitor::visitRebalanceStacks(RebalanceStacks & pack) { dispatchGarrisonChange(cl, pack.srcArmy, pack.dstArmy); - if(pack.srcArmy != pack.dstArmy) - cl.invalidatePaths(); // adding/removing units may change terrain type penalty based on creature native terrains + if(pack.srcArmy != pack.dstArmy) + cl.invalidatePaths(); // adding/removing units may change terrain type penalty based on creature native terrains } void ApplyClientNetPackVisitor::visitBulkRebalanceStacks(BulkRebalanceStacks & pack) @@ -258,8 +264,8 @@ void ApplyClientNetPackVisitor::visitBulkRebalanceStacks(BulkRebalanceStacks & p : pack.moves[0].dstArmy; dispatchGarrisonChange(cl, pack.moves[0].srcArmy, destArmy); - if(pack.moves[0].srcArmy != destArmy) - cl.invalidatePaths(); // adding/removing units may change terrain type penalty based on creature native terrains + if(pack.moves[0].srcArmy != destArmy) + cl.invalidatePaths(); // adding/removing units may change terrain type penalty based on creature native terrains } }