prevent error when an animal changes ownership
This was SVN commit r14720.
This commit is contained in:
parent
94a240737c
commit
e21f052803
@ -3202,8 +3202,10 @@ UnitAI.prototype.OnOwnershipChanged = function(msg)
|
|||||||
// If the unit isn't being created or dying, reset stance and clear orders (if not garrisoned).
|
// If the unit isn't being created or dying, reset stance and clear orders (if not garrisoned).
|
||||||
if (msg.to != -1 && msg.from != -1)
|
if (msg.to != -1 && msg.from != -1)
|
||||||
{
|
{
|
||||||
// Switch to an empty state to let states execute their leave handlers.
|
// Switch to a virgin state to let states execute their leave handlers.
|
||||||
UnitFsm.SwitchToNextState(this, "");
|
var index = this.GetCurrentState().indexOf(".");
|
||||||
|
if (index != -1)
|
||||||
|
UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|
||||||
|
|
||||||
this.SetStance(this.template.DefaultStance);
|
this.SetStance(this.template.DefaultStance);
|
||||||
if(!this.isGarrisoned)
|
if(!this.isGarrisoned)
|
||||||
|
Loading…
Reference in New Issue
Block a user