mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Fixed issue with taking creatures from a Bank, Pandora or joiners
This commit is contained in:
committed by
Andrii Danylchenko
parent
b52faad4c7
commit
6fb7301e8e
@@ -5572,13 +5572,21 @@ bool CGameHandler::isAllowedExchange(ObjectInstanceID id1, ObjectInstanceID id2)
|
||||
return true;
|
||||
}
|
||||
|
||||
//Ongoing garrison exchange
|
||||
if (auto dialog = std::dynamic_pointer_cast<CGarrisonDialogQuery>(queries.topQuery(o1->tempOwner)))
|
||||
//Ongoing garrison exchange - usually picking from top garison (from o1 to o2), but who knows
|
||||
auto dialog = std::dynamic_pointer_cast<CGarrisonDialogQuery>(queries.topQuery(o1->tempOwner));
|
||||
if (!dialog)
|
||||
{
|
||||
if (dialog->exchangingArmies.at(0) == o1 && dialog->exchangingArmies.at(1) == o2)
|
||||
dialog = std::dynamic_pointer_cast<CGarrisonDialogQuery>(queries.topQuery(o2->tempOwner));
|
||||
}
|
||||
if (dialog)
|
||||
{
|
||||
auto topArmy = dialog->exchangingArmies.at(0);
|
||||
auto bottomArmy = dialog->exchangingArmies.at(1);
|
||||
|
||||
if (topArmy == o1 && bottomArmy == o2)
|
||||
return true;
|
||||
|
||||
if (dialog->exchangingArmies.at(1) == o1 && dialog->exchangingArmies.at(0) == o2)
|
||||
if (bottomArmy == o1 && topArmy == o2)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user