mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Merge pull request #1635 from SoundSSGood/warmachine-buying-fix
warmachine buying fix
This commit is contained in:
commit
11dc9228e2
@ -804,10 +804,25 @@ void CCastleBuildings::enterBlacksmith(ArtifactID artifactID)
|
||||
LOCPLINT->showInfoDialog(boost::str(boost::format(CGI->generaltexth->allTexts[273]) % town->town->buildings.find(BuildingID::BLACKSMITH)->second->getNameTranslated()));
|
||||
return;
|
||||
}
|
||||
auto art = artifactID.toArtifact(CGI->artifacts());
|
||||
auto art = dynamic_cast<const CArtifact*>(artifactID.toArtifact(CGI->artifacts()));
|
||||
|
||||
int price = art->getPrice();
|
||||
bool possible = LOCPLINT->cb->getResourceAmount(Res::GOLD) >= price && !hero->hasArt(artifactID);
|
||||
bool possible = LOCPLINT->cb->getResourceAmount(Res::GOLD) >= price;
|
||||
if(possible)
|
||||
{
|
||||
for(auto slot : art->possibleSlots.at(ArtBearer::HERO))
|
||||
{
|
||||
if(hero->getArt(slot) == nullptr)
|
||||
{
|
||||
possible = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
possible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
CreatureID cre = art->getWarMachine();
|
||||
GH.pushIntT<CBlacksmithDialog>(possible, cre, artifactID, hero->id);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user