1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Fixes patrol position initialization on H3M load

This commit is contained in:
Ivan Savenko 2023-01-06 23:11:53 +02:00
parent 48c01157e6
commit 2f5ee44cbe
2 changed files with 4 additions and 9 deletions

View File

@ -319,6 +319,9 @@ void CGHeroInstance::initHero(CRandomGenerator & rand)
}
assert(validTypes());
if (patrol.patrolling)
patrol.initialPos = visitablePos();
if(exp == 0xffffffff)
{
initExp(rand);

View File

@ -1657,15 +1657,7 @@ CGObjectInstance * CMapLoaderH3M::readHero(ObjectInstanceID idToBeGiven, const i
nhi->formation = reader.readUInt8();
loadArtifactsOfHero(nhi);
nhi->patrol.patrolRadius = reader.readUInt8();
if(nhi->patrol.patrolRadius == 0xff)
{
nhi->patrol.patrolling = false;
}
else
{
nhi->patrol.patrolling = true;
nhi->patrol.initialPos = nhi->convertToVisitablePos(initialPos);
}
nhi->patrol.patrolling = (nhi->patrol.patrolRadius != 0xff);
if(map->version > EMapFormat::ROE)
{