1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

cleanup unused code

This commit is contained in:
SoundSSGood
2024-08-17 20:19:48 +03:00
parent 39bb6d5f39
commit cd7ebea9e3
14 changed files with 41 additions and 69 deletions

View File

@@ -3909,15 +3909,15 @@ bool CGameHandler::sacrificeCreatures(const IMarket * market, const CGHeroInstan
return true;
}
bool CGameHandler::sacrificeArtifact(const IMarket * m, const CGHeroInstance * hero, const std::vector<ArtifactInstanceID> & arts)
bool CGameHandler::sacrificeArtifact(const IMarket * market, const CGHeroInstance * hero, const ObjectInstanceID & marketId, const std::vector<ArtifactInstanceID> & arts)
{
if (!hero)
COMPLAIN_RET("You need hero to sacrifice artifact!");
if(hero->getAlignment() == EAlignment::EVIL)
COMPLAIN_RET("Evil hero can't sacrifice artifact!");
assert(m);
auto altarObj = dynamic_cast<const CGArtifactsAltar*>(m);
assert(market);
const auto artSet = getArtSet(marketId);
int expSum = 0;
auto finish = [this, &hero, &expSum]()
@@ -3927,15 +3927,15 @@ bool CGameHandler::sacrificeArtifact(const IMarket * m, const CGHeroInstance * h
for(const auto & artInstId : arts)
{
if(auto art = altarObj->getArtByInstanceId(artInstId))
if(auto art = artSet->getArtByInstanceId(artInstId))
{
if(art->artType->isTradable())
{
int dmp;
int expToGive;
m->getOffer(art->getTypeId(), 0, dmp, expToGive, EMarketMode::ARTIFACT_EXP);
market->getOffer(art->getTypeId(), 0, dmp, expToGive, EMarketMode::ARTIFACT_EXP);
expSum += expToGive;
removeArtifact(ArtifactLocation(altarObj->id, altarObj->getArtPos(art)));
removeArtifact(ArtifactLocation(marketId, artSet->getArtPos(art)));
}
else
{