1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Remove artifact assembly check for commanders

This commit is contained in:
dydzio 2016-11-03 19:49:55 +01:00
parent 9e366df70f
commit 03620b3cbe

View File

@ -96,6 +96,18 @@ static bool objectBlitOrderSorter(const TerrainTileObject & a, const TerrainTil
return CMapHandler::compareObjectBlitOrder(a.obj, b.obj);
}
struct HeroObjectRetriever : boost::static_visitor<const CGHeroInstance *>
{
const CGHeroInstance * operator()(const ConstTransitivePtr<CGHeroInstance> &h) const
{
return h;
}
const CGHeroInstance * operator()(const ConstTransitivePtr<CStackInstance> &s) const
{
return nullptr;
}
};
CPlayerInterface::CPlayerInterface(PlayerColor Player)
{
logGlobal->traceStream() << "\tHuman player interface for player " << Player << " being constructed";
@ -2511,11 +2523,11 @@ void CPlayerInterface::stacksRebalanced(const StackLocation &src, const StackLoc
void CPlayerInterface::askToAssembleArtifact(const ArtifactLocation &al)
{
auto hero = dynamic_cast<const CGHeroInstance*>(al.relatedObj());
if (hero)
auto hero = boost::apply_visitor(HeroObjectRetriever(), al.artHolder);
if(hero)
{
auto art = hero->getArt(al.slot);
if (art == nullptr)
if(art == nullptr)
{
logGlobal->error("artifact location %d points to nothing",
al.slot.num);