|
@@ -260,17 +260,28 @@ bool ArtifactUtilsClient::askToAssemble(const CGHeroInstance * hero, const Artif
|
|
|
assert(hero);
|
|
|
const auto art = hero->getArt(slot);
|
|
|
assert(art);
|
|
|
- auto assemblyPossibilities = ArtifactUtils::assemblyPossibilities(hero, art->getTypeId(), ArtifactUtils::isSlotEquipment(slot));
|
|
|
|
|
|
- for(const auto combinedArt : assemblyPossibilities)
|
|
|
- {
|
|
|
- LOCPLINT->showArtifactAssemblyDialog(
|
|
|
- art->artType,
|
|
|
- combinedArt,
|
|
|
- std::bind(&CCallback::assembleArtifacts, LOCPLINT->cb.get(), hero, slot, true, combinedArt->getId()));
|
|
|
+ if(hero->tempOwner != LOCPLINT->playerID)
|
|
|
+ return false;
|
|
|
|
|
|
- if(assemblyPossibilities.size() > 2)
|
|
|
- logGlobal->warn("More than one possibility of assembling on %s... taking only first", art->artType->getNameTranslated());
|
|
|
+ auto assemblyPossibilities = ArtifactUtils::assemblyPossibilities(hero, art->getTypeId(), ArtifactUtils::isSlotEquipment(slot));
|
|
|
+ if(!assemblyPossibilities.empty())
|
|
|
+ {
|
|
|
+ auto askThread = new boost::thread([hero, art, slot, assemblyPossibilities]() -> void
|
|
|
+ {
|
|
|
+ for(const auto combinedArt : assemblyPossibilities)
|
|
|
+ {
|
|
|
+ bool assembleConfirmed = false;
|
|
|
+ CFunctionList<void()> onYesHandlers([&assembleConfirmed]() -> void {assembleConfirmed = true; });
|
|
|
+ onYesHandlers += std::bind(&CCallback::assembleArtifacts, LOCPLINT->cb.get(), hero, slot, true, combinedArt->getId());
|
|
|
+
|
|
|
+ LOCPLINT->showArtifactAssemblyDialog(art->artType, combinedArt, onYesHandlers);
|
|
|
+ LOCPLINT->waitWhileDialog(false);
|
|
|
+ if(assembleConfirmed)
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ askThread->detach();
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
@@ -282,6 +293,9 @@ bool ArtifactUtilsClient::askToDisassemble(const CGHeroInstance * hero, const Ar
|
|
|
const auto art = hero->getArt(slot);
|
|
|
assert(art);
|
|
|
|
|
|
+ if(hero->tempOwner != LOCPLINT->playerID)
|
|
|
+ return false;
|
|
|
+
|
|
|
if(art->isCombined())
|
|
|
{
|
|
|
if(ArtifactUtils::isSlotBackpack(slot) && !ArtifactUtils::isBackpackFreeSlots(hero, art->artType->getConstituents().size() - 1))
|