Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#5745 closed defect (fixed)

Error when deleting the last unpacking bolt shooter

Reported by: elexis Owned by:
Priority: Release Blocker Milestone: Alpha 24
Component: Simulation Keywords:
Cc: Patch:

Description

If a player owns only one bolt shooter, unpacks it and deletes the unit while unpacking, there will be the following error, the error avoids setting the player to defeated and thus triggering an OOS. Reportedly reported long ago by Sheep54.

ERROR: Script message handler OnCapturePointsChanged failed
ERROR: Script message handler OnGlobalPlayerDefeated failed
ERROR: Script message handler OnGlobalPlayerDefeated failed
ERROR: Script message handler OnGlobalPlayerDefeated failed
ERROR: Script message handler OnGlobalPlayerDefeated failed
ERROR: JavaScript error: simulation/components/Pack.js line 101
TypeError: cmpPlayer is null
  Pack.prototype.GetPackTime@simulation/components/Pack.js:101:9
  Pack.prototype.GetProgress@simulation/components/Pack.js:111:37
  StatusBars.prototype.AddPackBar@simulation/components/StatusBars.js:169:58
  StatusBars.prototype.RegenerateSprites@simulation/components/StatusBars.js:123:14
  StatusBars.prototype.OnCapturePointsChanged@simulation/components/StatusBars.js:95:3
  Capturable.prototype.RegisterCapturePointsChanged@simulation/components/Capturable.js:142:1
  Capturable.prototype.OnGlobalPlayerDefeated@simulation/components/Capturable.js:322:2
  Player.prototype.SetState@simulation/components/Player.js:500:1
  Trigger.prototype.ConquestOwnershipChanged@maps/scripts/ConquestCommon.js:26:5
  Trigger.prototype.DoAction@simulation/components/Trigger.js:331:3
  Trigger.prototype.CallEvent@simulation/components/Trigger.js:225:4
  Trigger.prototype.OnGlobalOwnershipChanged@simulation/components/Trigger.js:270:2
ERROR: Script message handler OnGlobalOwnershipChanged failed
ERROR: Out-Of-Sync on turn 120

Reportedly coincidentally fixed in a24, but should be confirmed (and ensured that the bugfix not only consists of a GUI change but a simulation protection from error/OOS).

Change History (4)

comment:2 by wraitii, 4 years ago

I can confirm that this happened in A23 and no longer happens in current svn.

The code was:

let cmpPlayer = QueryOwnerInterface(this.entity, IID_Player);
return ApplyValueModificationsToEntity("Pack/Time", +this.template.Time, this.entity) * cmpPlayer.GetTimeMultiplier();

and is now (following Phab:rP22964)

return ApplyValueModificationsToEntity("Pack/Time", +this.template.Time, this.entity);

cmpPlayer is null because the entity has died. The new code is able to function for an entity with no owner.

This is indeed fixed correctly, but it seems like we could add a few checks in e.g. Capturable that the entity has a valid owner.

comment:3 by wraitii, 4 years ago

Resolution: fixed
Status: newclosed
Summary: OOS when deleting the last unpacking bolt shooterError when deleting the last unpacking bolt shooter

Fixed by Phab:rP22964.

See D2748 for a possible optimisation.

comment:4 by wraitii, 4 years ago

In 23709:

Do not compute capture points for the invalid player on player defeat

Reviewed By: Freagarach

Refs #5745

Differential Revision: https://code.wildfiregames.com/D2748

Note: See TracTickets for help on using tickets.