Opened 8 years ago
Closed 8 years ago
#366 closed defect (fixed)
Rewrite equipment handling and limits
Reported by: | ibboard | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | WarFoundry API 0.2 |
Component: | WarFoundry-API | Version: | Unknown or N/A |
Keywords: | equipment limit ratio | Cc: | |
Blocked By: | Blocking: |
Description
Bug #356 highlighted a bug in the equipment handling for units in conjunction with limits. While the bug can be fixed (it is just indirect recursion) there is a bigger underlying problem that was discovered during testing.
Because of the way that the equipment checks how big it could be (based on equipment and slot limits, where slots may contain multiple item types) and truncates itself appropriately then it is perfectly possible (e.g. line 51 in IBBoard.WarFoundry.API.Tests/API/Objects/UnitEquipmentLimitTests.cs @ revision 181:49b359624ea5 returns 0 when it should be 2 if we don't truncate or 1 if we work out how to resolve the conflict)
Change History (6)
comment:1 Changed 8 years ago by
comment:2 Changed 8 years ago by
Status: | new → confirmed |
---|
comment:3 Changed 8 years ago by
comment:4 Changed 8 years ago by
comment:5 Changed 8 years ago by
comment:6 Changed 8 years ago by
Owner: | set to IBBoard <dev@…> |
---|---|
Resolution: | → fixed |
Status: | confirmed → closed |
Note: See
TracTickets for help on using
tickets.
Obvious solution struck me after I left the computer - don't truncate but instead throw validation errors. That should reduce the complexity and likelihood of looping while still also giving users control (and it is only the tiny fraction of cases, like the original "0.7% of a unit of three rounds up to one trooper", where this would be a problem that the UI won't stop).