Opened 8 years ago
Closed 8 years ago
#356 closed defect (fixed)
issue with the percentageLimits in datafiles
Reported by: | Henri | Owned by: | ibboard |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | WarFoundry-API | Version: | WarFoundry 0.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Basically I found a way for the user to crash the program when percentageLimits are used.
Attached datafiles are used. Pick a unit of Reavers from Fast Attack. Basic unit of 3 models. A 1 Blaster, then go and pick a Heat lance. It won't allow you to pick one, however, you can add 0.7% percentages of one, and the percentage is also the default so it could be done by mistake. Program crashes when clicking OK.
Interestingly it won't happen if you pick them the other way around (Heat lance, then Blaster). Also do it "right" once and you can then subsequently do it the "wrong" way with the same or other units. Until you start a new army and do it "wrong" for the first time.
Obviously this could be an "author induced error" as the for the other "pair" of options which combines aboluteLimit with percentageLimit this won't happen.
Attachments (2)
Change History (14)
Changed 8 years ago by
Attachment: | wh40k - Warhammer 40k 5th edition 0.3b.system added |
---|
Changed 8 years ago by
Attachment: | wh40k - Dark Eldar v0.1.race added |
---|
comment:1 Changed 8 years ago by
Owner: | set to ibboard |
---|---|
Status: | new → accepted |
comment:2 Changed 8 years ago by
Or maybe not. That's going to be a pain - I recreated it the first time in the WinForms version, but the stack trace just kept on going. Now I keep restarting the WinForms app and can't recreate it. Still, it has happened once, so there is definitely something in the limits not playing nicely together.
comment:3 Changed 8 years ago by
The relevant snippet of the ongoing log from the first run was a repeat of the following:
at IBBoard.WarFoundry.API.Objects.Unit.GetSelectionTotal (System.Collections.Generic.List`1<IBBoard.WarFoundry.API.Objects.AbstractUnitEquipmentItemSelection>) <0x0004c> at IBBoard.WarFoundry.API.Objects.Unit.GetEquipmentAmountInSlotExcludingItem (IBBoard.WarFoundry.API.Objects.UnitEquipmentItem) <0x0008f> at IBBoard.WarFoundry.API.Util.UnitEquipmentUtil.GetEquipmentCountLimit (IBBoard.WarFoundry.API.Objects.Unit,int,IBBoard.WarFoundry.API.Objects.UnitEquipmentItem) <0x000bf> at IBBoard.WarFoundry.API.Util.UnitEquipmentUtil.GetMaxEquipmentCount (IBBoard.WarFoundry.API.Objects.Unit,IBBoard.WarFoundry.API.Objects.UnitEquipmentItem) <0x00057> at IBBoard.WarFoundry.API.Objects.UnitEquipmentRatioSelection.CalculateNumberTaken (IBBoard.WarFoundry.API.Objects.Unit,IBBoard.WarFoundry.API.Objects.UnitEquipmentItem,double) <0x00067> at IBBoard.WarFoundry.API.Objects.UnitEquipmentRatioSelection.get_NumberTaken () <0x00027>
Presumably it leads to a stack overflow exception.
comment:4 Changed 8 years ago by
Status: | accepted → needinfo |
---|
I'll try to create a test case for this that causes the error, but it looks like the data might not be helping. The Reavers have a slot with a 34% limit, rounding down, where as each individual weapon has a limit of 33%, defaulting to rounding up. That explains the 0.7% (1 in 3 = 33.3%,which is 0.7% lower than the slot limit).
Do the weapons need the limits if the slots they are in already have limits?
comment:5 Changed 8 years ago by
Status: | needinfo → accepted |
---|
For future reference, it does recreate in both. The instructions to recreate it are ever so slightly wrong:
Don't add one Blaster. Increase the number of blasters to 1 to make the %age read "33", but then stick with adding a percentage instead of a fixed number. Adding 1 doesn't cause a problem because the maths on the limit is easier as only the 0.7% is involved.
comment:6 Changed 8 years ago by
comment:7 Changed 8 years ago by
comment:8 Changed 8 years ago by
comment:9 Changed 8 years ago by
comment:10 Changed 8 years ago by
comment:11 Changed 8 years ago by
comment:12 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Seems to be fixed by comment:9. No overflow and results appear correct. Not sure what the larger flaw was, but it will be ticketed when it is found.
Sorry for the delay - the email notification must not have been working.
I just checked in the GTK UI and was read to throw it back as "need more info", because it behaved. Trying in the WinForms UI does cause an exception, though. I'll investigate the cause and why there is a difference.