Merge pull request #1885 from pyfa-org/issue1870

Implement fixes for #1870 - undo the Module.toDummy that happens when…
This commit is contained in:
Ryan Holmes
2019-03-20 18:01:30 -04:00
committed by GitHub
4 changed files with 46 additions and 40 deletions

View File

@@ -73,19 +73,21 @@ class FitReplaceModuleCommand(wx.Command):
# Dummy it out in case the next bit fails
fit.modules.toDummy(self.position)
if self.module.fits(fit):
self.module.owner = fit
fit.modules.toModule(self.position, self.module)
if self.module.isValidState(FittingModuleState.ACTIVE):
self.module.state = FittingModuleState.ACTIVE
if not self.module.fits(fit):
self.Undo()
return False
if self.old_module and self.old_module.charge and self.module.isValidCharge(self.old_module.charge):
self.module.charge = self.old_module.charge
self.module.owner = fit
fit.modules.toModule(self.position, self.module)
if self.module.isValidState(FittingModuleState.ACTIVE):
self.module.state = FittingModuleState.ACTIVE
# Then, check states of all modules and change where needed. This will recalc if needed
# self.checkStates(fit, m)
if self.old_module and self.old_module.charge and self.module.isValidCharge(self.old_module.charge):
self.module.charge = self.old_module.charge
# fit.fill()
eos.db.commit()
return True
return False
# Then, check states of all modules and change where needed. This will recalc if needed
# self.checkStates(fit, m)
# fit.fill()
eos.db.commit()
return True