فهرست منبع

Use isTradable and fix issue 1392

This change make it possible to sell spell scrolls in Artifacts Merchant.
ArseniyShestakov 10 سال پیش
والد
کامیت
4cb98e7e8d
3فایلهای تغییر یافته به همراه4 افزوده شده و 5 حذف شده
  1. 1 1
      client/widgets/CArtifactHolder.cpp
  2. 2 3
      client/windows/CTradeWindow.cpp
  3. 1 1
      server/CGameHandler.cpp

+ 1 - 1
client/widgets/CArtifactHolder.cpp

@@ -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.
 			}

+ 2 - 3
client/windows/CTradeWindow.cpp

@@ -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);

+ 1 - 1
server/CGameHandler.cpp

@@ -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;