|
@@ -1251,35 +1251,6 @@ void CPlayerInterface::showGarrisonDialog( const CArmedInstance *up, const CGHer
|
|
|
GH.windows().pushWindow(cgw);
|
|
GH.windows().pushWindow(cgw);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * Shows the dialog that appears when right-clicking an artifact that can be assembled
|
|
|
|
|
- * into a combinational one on an artifact screen. Does not require the combination of
|
|
|
|
|
- * artifacts to be legal.
|
|
|
|
|
- */
|
|
|
|
|
-void CPlayerInterface::showArtifactAssemblyDialog(const Artifact * artifact, const Artifact * assembledArtifact, CFunctionList<void()> onYes)
|
|
|
|
|
-{
|
|
|
|
|
- std::string text = artifact->getDescriptionTranslated();
|
|
|
|
|
- text += "\n\n";
|
|
|
|
|
- std::vector<std::shared_ptr<CComponent>> scs;
|
|
|
|
|
-
|
|
|
|
|
- if(assembledArtifact)
|
|
|
|
|
- {
|
|
|
|
|
- // You possess all of the components to...
|
|
|
|
|
- text += boost::str(boost::format(CGI->generaltexth->allTexts[732]) % assembledArtifact->getNameTranslated());
|
|
|
|
|
-
|
|
|
|
|
- // Picture of assembled artifact at bottom.
|
|
|
|
|
- auto sc = std::make_shared<CComponent>(ComponentType::ARTIFACT, assembledArtifact->getId());
|
|
|
|
|
- scs.push_back(sc);
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- // Do you wish to disassemble this artifact?
|
|
|
|
|
- text += CGI->generaltexth->allTexts[733];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- showYesNoDialog(text, onYes, nullptr, scs);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
void CPlayerInterface::requestRealized( PackageApplied *pa )
|
|
void CPlayerInterface::requestRealized( PackageApplied *pa )
|
|
|
{
|
|
{
|
|
|
if(pa->packType == CTypeList::getInstance().getTypeID<MoveHero>(nullptr))
|
|
if(pa->packType == CTypeList::getInstance().getTypeID<MoveHero>(nullptr))
|
|
@@ -1739,14 +1710,14 @@ void CPlayerInterface::askToAssembleArtifact(const ArtifactLocation &al)
|
|
|
{
|
|
{
|
|
|
if(auto hero = cb->getHero(al.artHolder))
|
|
if(auto hero = cb->getHero(al.artHolder))
|
|
|
{
|
|
{
|
|
|
- auto art = hero->getArt(al.slot);
|
|
|
|
|
- if(art == nullptr)
|
|
|
|
|
|
|
+ if(hero->getArt(al.slot) == nullptr)
|
|
|
{
|
|
{
|
|
|
- logGlobal->error("artifact location %d points to nothing",
|
|
|
|
|
- al.slot.num);
|
|
|
|
|
|
|
+ logGlobal->error("artifact location %d points to nothing", al.slot.num);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- ArtifactUtilsClient::askToAssemble(hero, al.slot);
|
|
|
|
|
|
|
+ askToAssemble(hero, al.slot, &ignoredArtifacts);
|
|
|
|
|
+ if(numOfArtsAskAssembleSession != 0)
|
|
|
|
|
+ numOfArtsAskAssembleSession--;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1760,55 +1731,33 @@ void CPlayerInterface::artifactRemoved(const ArtifactLocation &al)
|
|
|
{
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
adventureInt->onHeroChanged(cb->getHero(al.artHolder));
|
|
adventureInt->onHeroChanged(cb->getHero(al.artHolder));
|
|
|
-
|
|
|
|
|
- for(auto artWin : GH.windows().findWindows<CWindowWithArtifacts>())
|
|
|
|
|
- artWin->artifactRemoved(al);
|
|
|
|
|
-
|
|
|
|
|
- waitWhileDialog();
|
|
|
|
|
|
|
+ ArtifactsUIController::artifactRemoved();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void CPlayerInterface::artifactMoved(const ArtifactLocation &src, const ArtifactLocation &dst)
|
|
void CPlayerInterface::artifactMoved(const ArtifactLocation &src, const ArtifactLocation &dst)
|
|
|
{
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
adventureInt->onHeroChanged(cb->getHero(dst.artHolder));
|
|
adventureInt->onHeroChanged(cb->getHero(dst.artHolder));
|
|
|
-
|
|
|
|
|
- // If a bulk transfer has arrived, then redrawing only the last art movement.
|
|
|
|
|
- if(numOfMovedArts != 0)
|
|
|
|
|
- numOfMovedArts--;
|
|
|
|
|
-
|
|
|
|
|
- for(auto artWin : GH.windows().findWindows<CWindowWithArtifacts>())
|
|
|
|
|
- {
|
|
|
|
|
- artWin->artifactMoved(src, dst);
|
|
|
|
|
- if(numOfMovedArts == 0)
|
|
|
|
|
- {
|
|
|
|
|
- artWin->update();
|
|
|
|
|
- artWin->redraw();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- waitWhileDialog();
|
|
|
|
|
|
|
+ ArtifactsUIController::artifactMoved();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void CPlayerInterface::bulkArtMovementStart(size_t numOfArts)
|
|
void CPlayerInterface::bulkArtMovementStart(size_t numOfArts)
|
|
|
{
|
|
{
|
|
|
- numOfMovedArts = numOfArts;
|
|
|
|
|
|
|
+ ArtifactsUIController::bulkArtMovementStart(numOfArts);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void CPlayerInterface::artifactAssembled(const ArtifactLocation &al)
|
|
void CPlayerInterface::artifactAssembled(const ArtifactLocation &al)
|
|
|
{
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
adventureInt->onHeroChanged(cb->getHero(al.artHolder));
|
|
adventureInt->onHeroChanged(cb->getHero(al.artHolder));
|
|
|
-
|
|
|
|
|
- for(auto artWin : GH.windows().findWindows<CWindowWithArtifacts>())
|
|
|
|
|
- artWin->artifactAssembled(al);
|
|
|
|
|
|
|
+ ArtifactsUIController::artifactAssembled();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void CPlayerInterface::artifactDisassembled(const ArtifactLocation &al)
|
|
void CPlayerInterface::artifactDisassembled(const ArtifactLocation &al)
|
|
|
{
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
adventureInt->onHeroChanged(cb->getHero(al.artHolder));
|
|
adventureInt->onHeroChanged(cb->getHero(al.artHolder));
|
|
|
-
|
|
|
|
|
- for(auto artWin : GH.windows().findWindows<CWindowWithArtifacts>())
|
|
|
|
|
- artWin->artifactDisassembled(al);
|
|
|
|
|
|
|
+ ArtifactsUIController::artifactDisassembled();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void CPlayerInterface::waitForAllDialogs()
|
|
void CPlayerInterface::waitForAllDialogs()
|