mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Fix rare crash on merging two stacks in town garrison with stack
artifacts equipped
This commit is contained in:
@@ -1639,13 +1639,19 @@ void RebalanceStacks::applyGs(CGameState *gs)
|
|||||||
{
|
{
|
||||||
if(auto dstArt = dstStack->getArt(ArtifactPosition::CREATURE_SLOT))
|
if(auto dstArt = dstStack->getArt(ArtifactPosition::CREATURE_SLOT))
|
||||||
{
|
{
|
||||||
auto dstSlot = ArtifactUtils::getArtBackpackPosition(srcHero, dstArt->getTypeId());
|
bool artifactIsLost = true;
|
||||||
if(srcHero && dstSlot != ArtifactPosition::PRE_FIRST)
|
|
||||||
|
if(srcHero)
|
||||||
{
|
{
|
||||||
gs->map->moveArtifactInstance(*dstStack, ArtifactPosition::CREATURE_SLOT, *srcHero, dstSlot);
|
auto dstSlot = ArtifactUtils::getArtBackpackPosition(srcHero, dstArt->getTypeId());
|
||||||
|
if (dstSlot != ArtifactPosition::PRE_FIRST)
|
||||||
|
{
|
||||||
|
gs->map->moveArtifactInstance(*dstStack, ArtifactPosition::CREATURE_SLOT, *srcHero, dstSlot);
|
||||||
|
artifactIsLost = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//else - artifact can be lost :/
|
|
||||||
else
|
if (artifactIsLost)
|
||||||
{
|
{
|
||||||
BulkEraseArtifacts ea;
|
BulkEraseArtifacts ea;
|
||||||
ea.artHolder = dstHero->id;
|
ea.artHolder = dstHero->id;
|
||||||
|
|||||||
Reference in New Issue
Block a user