Browse Source

Functional RMG Seer Huts, still there are some mysterious bugs.

DjWarmonger 10 years ago
parent
commit
6ace53d8b9
1 changed files with 4 additions and 10 deletions
  1. 4 10
      lib/rmg/CRmgTemplateZone.cpp

+ 4 - 10
lib/rmg/CRmgTemplateZone.cpp

@@ -2295,20 +2295,17 @@ void CRmgTemplateZone::addAllPossibleObjects(CMapGenerator* gen)
 
 
 		RandomGeneratorUtil::randomShuffle(creatures, gen->rand);
 		RandomGeneratorUtil::randomShuffle(creatures, gen->rand);
 
 
-		auto generateArtInfo = [](ArtifactID id) -> ObjectInfo
+		auto generateArtInfo = [this](ArtifactID id) -> ObjectInfo
 		{
 		{
 			ObjectInfo artInfo;
 			ObjectInfo artInfo;
 			artInfo.probability = 1e6; //99,9% to spawn that art in first treasure pile
 			artInfo.probability = 1e6; //99,9% to spawn that art in first treasure pile
 			artInfo.maxPerZone = 1;
 			artInfo.maxPerZone = 1;
 			artInfo.value = 2000; //treasure art
 			artInfo.value = 2000; //treasure art
+			artInfo.setTemplate(Obj::ARTIFACT, id, this->terrainType);
 			artInfo.generateObject = [id]() -> CGObjectInstance *
 			artInfo.generateObject = [id]() -> CGObjectInstance *
 			{
 			{
-				auto obj = new CGArtifact;
-				obj->ID = Obj::ARTIFACT;
-				obj->subID = id;
-
-				return obj;
-				//TODO: place required artifact in next zone
+				auto handler = VLC->objtypeh->getHandlerFor(Obj::ARTIFACT, id);
+				return handler->create(handler->getTemplates().front());
 			};
 			};
 			return artInfo;
 			return artInfo;
 		};
 		};
@@ -2341,7 +2338,6 @@ void CRmgTemplateZone::addAllPossibleObjects(CMapGenerator* gen)
 				this->questArtZone->possibleObjects.push_back (generateArtInfo(artid));
 				this->questArtZone->possibleObjects.push_back (generateArtInfo(artid));
 
 
 				return obj;
 				return obj;
-				//TODO: place required artifact in next zone
 			};
 			};
 			oi.setTemplate(Obj::SEER_HUT, randomAppearance, terrainType);
 			oi.setTemplate(Obj::SEER_HUT, randomAppearance, terrainType);
 			oi.value = ((2 * (creature->AIValue) * creaturesAmount * (1 + (float)(gen->getZoneCount(creature->faction)) / gen->getTotalZoneCount())) - 4000) / 3;
 			oi.value = ((2 * (creature->AIValue) * creaturesAmount * (1 + (float)(gen->getZoneCount(creature->faction)) / gen->getTotalZoneCount())) - 4000) / 3;
@@ -2378,7 +2374,6 @@ void CRmgTemplateZone::addAllPossibleObjects(CMapGenerator* gen)
 				this->questArtZone->possibleObjects.push_back(generateArtInfo(artid));
 				this->questArtZone->possibleObjects.push_back(generateArtInfo(artid));
 
 
 				return obj;
 				return obj;
-				//TODO: place required artifact in next zone
 			};
 			};
 
 
 			possibleObjects.push_back(oi);
 			possibleObjects.push_back(oi);
@@ -2401,7 +2396,6 @@ void CRmgTemplateZone::addAllPossibleObjects(CMapGenerator* gen)
 				this->questArtZone->possibleObjects.push_back(generateArtInfo(artid));
 				this->questArtZone->possibleObjects.push_back(generateArtInfo(artid));
 
 
 				return obj;
 				return obj;
-				//TODO: place required artifact in next zone
 			};
 			};
 
 
 			possibleObjects.push_back(oi);
 			possibleObjects.push_back(oi);