Преглед изворни кода

CMapLoaderH3M: support for patrol initialPos in readHero

ArseniyShestakov пре 10 година
родитељ
комит
d6a142ca3d
2 измењених фајлова са 4 додато и 3 уклоњено
  1. 3 2
      lib/mapping/MapFormatH3M.cpp
  2. 1 1
      lib/mapping/MapFormatH3M.h

+ 3 - 2
lib/mapping/MapFormatH3M.cpp

@@ -1060,7 +1060,7 @@ void CMapLoaderH3M::readObjects()
 		case Obj::RANDOM_HERO:
 		case Obj::PRISON:
 			{
-				nobj = readHero(idToBeGiven);
+				nobj = readHero(idToBeGiven, objPos);
 				break;
 			}
 		case Obj::MONSTER:  //Monster
@@ -1549,7 +1549,7 @@ void CMapLoaderH3M::readCreatureSet(CCreatureSet * out, int number)
 	out->validTypes(true);
 }
 
-CGObjectInstance * CMapLoaderH3M::readHero(ObjectInstanceID idToBeGiven)
+CGObjectInstance * CMapLoaderH3M::readHero(ObjectInstanceID idToBeGiven, const int3 & initialPos)
 {
 	auto nhi = new CGHeroInstance();
 
@@ -1658,6 +1658,7 @@ CGObjectInstance * CMapLoaderH3M::readHero(ObjectInstanceID idToBeGiven)
 	else
 	{
 		nhi->patrol.patrolling = true;
+		nhi->patrol.initialPos = initialPos;
 	}
 
 	if(map->version > EMapFormat::ROE)

+ 1 - 1
lib/mapping/MapFormatH3M.h

@@ -172,7 +172,7 @@ private:
 	 * @param idToBeGiven the object id which should be set for the hero
 	 * @return a object instance
 	 */
-	CGObjectInstance * readHero(ObjectInstanceID idToBeGiven);
+	CGObjectInstance * readHero(ObjectInstanceID idToBeGiven, const int3 & initialPos);
 
 	/**
 	 * Reads a seer hut.