소스 검색

Merge pull request #2230 from vcmi/fix_seer_huts

Fix crash which could occur if we can't add any Seer Hut to RMG pool
DjWarmonger 2 년 전
부모
커밋
79a1041648
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      lib/rmg/modificators/TreasurePlacer.cpp

+ 8 - 0
lib/rmg/modificators/TreasurePlacer.cpp

@@ -406,6 +406,10 @@ void TreasurePlacer::addAllPossibleObjects()
 		}
 		
 		const int questArtsRemaining = qap->getMaxQuestArtifactCount();
+		if (!questArtsRemaining)
+		{
+			return;
+		}
 		
 		//Generate Seer Hut one by one. Duplicated oi possible and should work fine.
 		oi.maxPerZone = 1;
@@ -520,6 +524,10 @@ void TreasurePlacer::addAllPossibleObjects()
 			possibleSeerHuts.push_back(oi);
 		}
 
+		if (possibleSeerHuts.empty())
+		{
+			return;
+		}
 		for (size_t i = 0; i < questArtsRemaining; i++)
 		{
 			addObjectToRandomPool(*RandomGeneratorUtil::nextItem(possibleSeerHuts, zone.getRand()));