Fit Calculation Code Cleanup (#1103)

* Remove dirtyStorage, legacy of old fleet boosting system

* Remove withBooster flag from the recalc() function.

This was a legacy parameter dealing with the old fleet boost code, the purpose of which has changed with the addition of command boosts. We no longer have to call recalc with this particular parameter (indeed, it was forced to False in `recalc`). These were never cleaned up. We still have the withBoosters parameter for the `calculateModifiedAttributes` function, however that will be renamed and has a different meaning than it used to (used in the recursion of command fits)

* Add some comments

* Consolidate the tangled mess of conditional flags meant to determine if a fit is local/projected/command. This should make the logic flow a bit clearer.

Also rewrite a blurb about returning on a calculated fit - need to look into this a little bit more.

* fix up test to no longer pass `withBooster`
This commit is contained in:
Ryan Holmes
2017-04-12 19:50:16 -04:00
committed by GitHub
parent 87a600349c
commit 5aeb3a38c8
3 changed files with 62 additions and 44 deletions

View File

@@ -60,7 +60,7 @@ def test_calculateModifiedAttributes(DB, RifterFit, KeepstarFit):
for test_dict in keepstar_modifier_dicts:
assert len(getattr(KeepstarFit.ship.itemModifiedAttributes, test_dict)) == keepstar_modifier_dicts[test_dict]
def test_calculateModifiedAttributes_withBooster(DB, RifterFit, HeronFit):
def test_calculateModifiedAttributes_withProjected(DB, RifterFit, HeronFit):
# TODO: This test is not currently functional or meaningful as projections are not happening correctly.
# This is true for all tested branches (master, dev, etc)
rifter_modifier_dicts = {
@@ -106,15 +106,15 @@ def test_calculateModifiedAttributes_withBooster(DB, RifterFit, HeronFit):
scan_resolution_3 = RifterFit.ship.getModifiedItemAttr('scanResolution')
RifterFit.clear()
RifterFit.calculateModifiedAttributes(withBoosters=True)
RifterFit.calculateModifiedAttributes()
# Get stats with projections
max_target_range_4 = RifterFit.ship.getModifiedItemAttr('maxTargetRange')
scan_resolution_4 = RifterFit.ship.getModifiedItemAttr('scanResolution')
RifterFit.clear()
HeronFit.calculateModifiedAttributes(targetFit=RifterFit, withBoosters=True)
RifterFit.calculateModifiedAttributes(withBoosters=True)
HeronFit.calculateModifiedAttributes(targetFit=RifterFit)
RifterFit.calculateModifiedAttributes()
# Get stats with projections
max_target_range_5 = RifterFit.ship.getModifiedItemAttr('maxTargetRange')