Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#352 closed defect (fixed)

Test/fix cyclic references in unit types

Reported by: ibboard Owned by: IBBoard <dev@…>
Priority: critical Milestone: WarFoundry API 0.2
Component: WarFoundry-API Version: Unknown or N/A
Keywords: Cc:
Blocked By: Blocking:

Description

If a pair of unit types reference each other (e.g. they are mutually exclusive and each says "may not have any of other unit to take this unit") then the current implementation of the Race XML factory may have problems.

From a quick skim then it doesn't add the unit to the race until it is complete, so the "get by ID from the race, else fall back to getting by ID from the file and loading" code will hit a cyclic loop as it never adds the unit to the race, so it'll always try to load it, find the reference to the other unit, load that from the file, find the reference to the first unit, load that from the file again and so on.

Change History (4)

comment:1 Changed 8 years ago by ibboard

Status: newconfirmed

comment:2 Changed 8 years ago by ibboard

Priority: majorcritical

Increasing priority - causes stack overflows when it occurs!

comment:3 Changed 8 years ago by IBBoard <dev@…>

Owner: set to IBBoard <dev@…>
Resolution: fixed
Status: confirmedclosed

In [8811737baebf64d127149950e52d1db531b34a1d/IBBoard.WarFoundry.API]:

Fixes #352: Test/fix cyclic references in unit types

  • Tell the Race it has a new UnitType earlier to resolve load loops
  • Update example data file to one that uses all requirements, but caused cyclic issues

comment:4 Changed 8 years ago by IBBoard <dev@…>

In [2b27447ae74e9f5087414681b901f215a1542fd7/IBBoard.WarFoundry.API.Tests]:

Re #352: Test/fix cyclic references in unit types

  • Add test case
Note: See TracTickets for help on using tickets.