mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Merge remote-tracking branch 'remotes/dydzio/CommanderArtifacts2' into develop
This commit is contained in:
commit
08252a1282
@ -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";
|
||||
@ -2518,11 +2530,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);
|
||||
|
Loading…
Reference in New Issue
Block a user