Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#270 closed enhancement (released)

Add multiple categories to API

Reported by: ibboard Owned by: ibboard
Priority: major Milestone: WarFoundry 0.1
Component: WarFoundry-API Version: Trunk
Keywords: categories multiple reuse Cc:
Blocked By: Blocking:

Description

To reduce duplication of unit definitions we need to be able to say that a unit can be part of multiple categories (e.g. a troop type whose allowed category allocation changes depending on other troop selections).

This needs careful consideration as to how it relates to the existing "cat" value (perhaps a deprecated value that is treated as a single category for the unit). We also need to make sure that we add the unit under the right category when creating it, as it could be listed in two different places.

The actual requirements that say "Unit type X is normally a Support option, but can be taken as a Troop option if Unit type Y is also taken" should be handled in a separate ticket once #27 is completed.

Change History (17)

comment:1 Changed 10 years ago by ibboard

Blocking: 271 added

comment:2 Changed 10 years ago by ibboard

Status: newconfirmed

Confirm new tickets

comment:3 Changed 10 years ago by ibboard

Owner: set to ibboard
Status: confirmedaccepted

comment:4 Changed 10 years ago by ibboard

(In r558) Re #270: Add multiple categories to API

  • Add Categories property
  • Add method to add Category
  • Tie up Categories with MainCategory for default behaviour

comment:5 Changed 10 years ago by ibboard

(In r559) Re #270: Add multiple categories to API

  • Add tests for new property and default behaviour

comment:6 Changed 10 years ago by ibboard

(In r562) Re #270: Add multiple categories to API

  • Add more tests of behaviour

comment:7 Changed 10 years ago by ibboard

(In r563) Re #270: Add multiple categories to API

  • Add unit tests and test data for handling multiple categories and existing method

comment:8 Changed 10 years ago by ibboard

(In r564) Re #270: Add multiple categories to API

  • Add section for multiple categories to schema
  • Add category loading to factory

Also:

  • Do more sensible check on whether we need to set MainCategory when adding category to unit type

comment:9 Changed 10 years ago by ibboard

TODO: Make the unit actually show up in multiple categories.

comment:10 Changed 10 years ago by ibboard

(In r565) Re #270: Add multiple categories to API

  • Add test for unit being in multiple categories

Also:

  • Add assertions in other tests that unit is cached in army

comment:11 Changed 10 years ago by ibboard

(In r566) Re #270: Add multiple categories to API

  • Make Race cache new units against each category

comment:12 Changed 10 years ago by ibboard

(In r567) Re #270: Add multiple categories to API

  • Add tests for army loading to make sure that units go back in same category

comment:13 Changed 10 years ago by ibboard

(In r568) Re #270: Add multiple categories to API

  • Add "category" attribute to army schema
  • Add method to define category when adding unit to army
  • Make army loading check new attribute and assign to correct category or main category

TODO: Write out category of unit to army file

comment:14 Changed 10 years ago by ibboard

(In r569) Re #270: Add multiple categories to API

  • Save out category if it isn't the main category

comment:15 Changed 10 years ago by ibboard

Resolution: fixed
Status: acceptedclosed

All works fine in WinForms UI (create army, create unit in each category, save army, re-load army).

comment:16 Changed 10 years ago by ibboard

Resolution: fixedreleased

Release as part of v0.1b9

comment:17 Changed 8 years ago by ibboard

Blocking: 271 removed

(In #271) Dupe - better explained in #396.

Note: See TracTickets for help on using tickets.