Opened 9 years ago

Closed 8 years ago

#353 closed defect (fixed)

Handle unloaded units being referenced outside factory

Reported by: ibboard Owned by: ibboard
Priority: major Milestone: WarFoundry API 0.2
Component: WarFoundry-API Version: Trunk
Keywords: Cc:
Blocked By: Blocking: #351

Description

Now that we're handling requirements then the Race factory is handing work off to other factories. These other factories have to make certain assumptions about how they can work (e.g. they have to assume that they could be working with any factory). These assumptions cause problems when it comes to requirements referencing units that haven't been loaded yet - Race.GetUnitType(id) fails because the load has been triggered but the unit isn't loaded yet, so it returns a null.

We can't just wait for loading to complete before Race.GetUnitType(id) completes, because that would hang the factory. Instead, we need to standardise things so that external factories can use the Race factory to get at objects.

Change History (6)

comment:1 Changed 9 years ago by ibboard

Owner: set to ibboard
Status: newaccepted

comment:2 Changed 9 years ago by ibboard

In [951]:

Re #353: Handle unloaded units being referenced outside factory

  • Remove inheritance prior to creation of more generalised sub-factory inheritance
  • Create helper class that contains the only common code from old inheritance to keep duplication down

comment:3 Changed 9 years ago by ibboard

In [952]:

Re #353: Handle unloaded units being referenced outside factory

  • Create interface for race factories
  • Start to pull out common methods and add "try unit and fall back to factory" method for getting unit types
  • Make XML Race Factory implement interface
  • Use new factory

comment:4 Changed 9 years ago by ibboard

In [953]:

Re #353: Handle unloaded units being referenced outside factory

  • Add mock factory and use it in tests

All tests now pass (including tests that started failing because of unit loading order - triggered by requirement changes)

comment:5 Changed 8 years ago by ibboard

In [954]:

Re #353: Handle unloaded units being referenced outside factory

  • Remove old named method and update references

comment:6 Changed 8 years ago by ibboard

Resolution: fixed
Status: acceptedclosed

In [955]:

Fixes #353: Handle unloaded units being referenced outside factory

  • Update final reference
Note: See TracTickets for help on using tickets.