Răsfoiți Sursa

Use switch for CArtHandler::isTradableArtifact

ArseniyShestakov 10 ani în urmă
părinte
comite
04d15174e7
1 a modificat fișierele cu 11 adăugiri și 3 ștergeri
  1. 11 3
      lib/CArtHandler.cpp

+ 11 - 3
lib/CArtHandler.cpp

@@ -585,10 +585,18 @@ bool CArtHandler::legalArtifact(ArtifactID id)
 
 
 bool CArtHandler::isTradableArtifact(ArtifactID id) const
 bool CArtHandler::isTradableArtifact(ArtifactID id) const
 {
 {
-	if (id < 7 && id != ArtifactID::SPELL_SCROLL)
+	switch (id)
+	{
+	case ArtifactID::SPELLBOOK:
+	case ArtifactID::GRAIL:
+	case ArtifactID::CATAPULT:
+	case ArtifactID::BALLISTA:
+	case ArtifactID::AMMO_CART:
+	case ArtifactID::FIRST_AID_TENT:
 		return false;
 		return false;
-
-	return true;
+	default:
+		return true;
+	}
 }
 }
 
 
 void CArtHandler::initAllowedArtifactsList(const std::vector<bool> &allowed)
 void CArtHandler::initAllowedArtifactsList(const std::vector<bool> &allowed)