Fix serialisation crash when patrolling.

6778fc4ea6 introduced waiting at the patrol points, but it was possible
that at such a point an enemy was noticed, thus quiting the "look
around" state, deleting `this.stopSurveying`, which was later `++`-ed.
That lead to an `NaN` property which got serialised. `NaN` serialisation
crashes as of 0e7fafebe1.

Differential revision: https://code.wildfiregames.com/D4177
Reported in:
https://wildfiregames.com/forum/topic/41264-alpha-25-pre-releaserelease-candidate-build-testing/page/4/?tab=comments#comment-435709
Reviewed by: @wraitii
This was SVN commit r25804.
This commit is contained in:
Freagarach 2021-06-17 07:40:24 +00:00
parent 17c54d5a69
commit 8c7d77a610

View File

@ -1116,8 +1116,8 @@ UnitAI.prototype.UnitFsmSpec = {
this.FinishOrder(); this.FinishOrder();
return; return;
} }
this.FindWalkAndFightTargets(); if (!this.FindWalkAndFightTargets())
++this.stopSurveying; ++this.stopSurveying;
} }
} }
}, },
@ -1819,8 +1819,8 @@ UnitAI.prototype.UnitFsmSpec = {
this.FinishOrder(); this.FinishOrder();
return; return;
} }
this.FindWalkAndFightTargets(); if (!this.FindWalkAndFightTargets())
++this.stopSurveying; ++this.stopSurveying;
} }
} }
}, },