1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

Use isTradable and fix issue 1392

This change make it possible to sell spell scrolls in Artifacts Merchant.
This commit is contained in:
ArseniyShestakov 2014-12-24 20:48:37 +03:00
parent de6752c048
commit 4cb98e7e8d
3 changed files with 4 additions and 5 deletions

View File

@ -105,7 +105,7 @@ void CArtPlace::clickLeft(tribool down, bool previousState)
{
if(down)
{
if(ourArt->artType->id < 7) //War Machine or Spellbook
if(!ourArt->artType->isTradable()) //War Machine or Spellbook
{
LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[21]); //This item can't be traded.
}

View File

@ -1459,8 +1459,7 @@ void CAltarWindow::showAll(SDL_Surface * to)
bool CAltarWindow::putOnAltar(CTradeableItem* altarSlot, const CArtifactInstance *art)
{
int artID = art->artType->id;
if(artID != ArtifactID::SPELL_SCROLL && artID < 7) //special art
if(!art->artType->isTradable()) //special art
{
logGlobal->warnStream() << "Cannot put special artifact on altar!";
return false;
@ -1478,7 +1477,7 @@ bool CAltarWindow::putOnAltar(CTradeableItem* altarSlot, const CArtifactInstance
}
int dmp, val;
market->getOffer(artID, 0, dmp, val, EMarketMode::ARTIFACT_EXP);
market->getOffer(art->artType->id, 0, dmp, val, EMarketMode::ARTIFACT_EXP);
arts->artifactsOnAltar.insert(art);
altarSlot->setArtInstance(art);

View File

@ -2971,7 +2971,7 @@ bool CGameHandler::sellArtifact( const IMarket *m, const CGHeroInstance *h, Arti
const CArtifactInstance *art = h->getArtByInstanceId(aid);
if(!art)
COMPLAIN_RET("There is no artifact to sell!");
if(art->artType->id < 7)
if(!art->artType->isTradable())
COMPLAIN_RET("Cannot sell a war machine or spellbook!");
int resVal = 0, dump = 1;