mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Fixed CID 1197353
This commit is contained in:
parent
2dd6a47764
commit
2a62ca9522
@ -1340,17 +1340,6 @@ bool CArtifactSet::isPositionFree(ArtifactPosition pos, bool onlyLockCheck /*= f
|
|||||||
return true; //no slot means not used
|
return true; //no slot means not used
|
||||||
}
|
}
|
||||||
|
|
||||||
si32 CArtifactSet::getArtTypeId(ArtifactPosition pos) const
|
|
||||||
{
|
|
||||||
const CArtifactInstance * const a = getArt(pos);
|
|
||||||
if(!a)
|
|
||||||
{
|
|
||||||
logGlobal->warnStream() << (dynamic_cast<const CGHeroInstance*>(this))->name << " has no artifact at " << pos << " (getArtTypeId)";
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return a->artType->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
ArtSlotInfo & CArtifactSet::retreiveNewArtSlot(ArtifactPosition slot)
|
ArtSlotInfo & CArtifactSet::retreiveNewArtSlot(ArtifactPosition slot)
|
||||||
{
|
{
|
||||||
assert(!vstd::contains(artifactsWorn, slot));
|
assert(!vstd::contains(artifactsWorn, slot));
|
||||||
|
@ -320,7 +320,6 @@ public:
|
|||||||
/// Checks if hero possess artifact of given id (either in backack or worn)
|
/// Checks if hero possess artifact of given id (either in backack or worn)
|
||||||
bool hasArt(ui32 aid, bool onlyWorn = false, bool searchBackpackAssemblies = false) const;
|
bool hasArt(ui32 aid, bool onlyWorn = false, bool searchBackpackAssemblies = false) const;
|
||||||
bool isPositionFree(ArtifactPosition pos, bool onlyLockCheck = false) const;
|
bool isPositionFree(ArtifactPosition pos, bool onlyLockCheck = false) const;
|
||||||
si32 getArtTypeId(ArtifactPosition pos) const;
|
|
||||||
|
|
||||||
virtual ArtBearer::ArtBearer bearerType() const = 0;
|
virtual ArtBearer::ArtBearer bearerType() const = 0;
|
||||||
virtual ~CArtifactSet() = default;
|
virtual ~CArtifactSet() = default;
|
||||||
|
@ -5284,9 +5284,10 @@ bool CGameHandler::sacrificeArtifact(const IMarket * m, const CGHeroInstance * h
|
|||||||
COMPLAIN_RET_FALSE_IF(!a,"Cannot find artifact to sacrifice!");
|
COMPLAIN_RET_FALSE_IF(!a,"Cannot find artifact to sacrifice!");
|
||||||
|
|
||||||
int dmp, expToGive;
|
int dmp, expToGive;
|
||||||
auto typId = hero->getArtTypeId(slot);
|
const CArtifactInstance * art = hero->getArt(slot);
|
||||||
|
COMPLAIN_RET_FALSE_IF((!art), "No artifact at position to sacrifice!");
|
||||||
|
|
||||||
COMPLAIN_RET_FALSE_IF(typId<0, "No artifact at position!");
|
si32 typId = art->artType->id;
|
||||||
|
|
||||||
m->getOffer(typId, 0, dmp, expToGive, EMarketMode::ARTIFACT_EXP);
|
m->getOffer(typId, 0, dmp, expToGive, EMarketMode::ARTIFACT_EXP);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user