Avoid fit recalc when setting state has no effect
This commit is contained in:
@@ -940,21 +940,27 @@ class Fit(object):
|
||||
self.recalc(fit)
|
||||
|
||||
def toggleModulesState(self, fitID, base, modules, click):
|
||||
changed = False
|
||||
proposedState = self.__getProposedState(base, click)
|
||||
|
||||
if proposedState != base.state:
|
||||
changed = True
|
||||
base.state = proposedState
|
||||
for mod in modules:
|
||||
if mod != base:
|
||||
mod.state = self.__getProposedState(mod, click,
|
||||
proposedState)
|
||||
p = self.__getProposedState(mod, click, proposedState)
|
||||
mod.state = p
|
||||
if p != mod.state:
|
||||
changed = True
|
||||
|
||||
eos.db.commit()
|
||||
fit = eos.db.getFit(fitID)
|
||||
if changed:
|
||||
eos.db.commit()
|
||||
fit = eos.db.getFit(fitID)
|
||||
|
||||
# As some items may affect state-limiting attributes of the ship, calculate new attributes first
|
||||
self.recalc(fit)
|
||||
# Then, check states of all modules and change where needed. This will recalc if needed
|
||||
self.checkStates(fit, base)
|
||||
# As some items may affect state-limiting attributes of the ship, calculate new attributes first
|
||||
self.recalc(fit)
|
||||
# Then, check states of all modules and change where needed. This will recalc if needed
|
||||
self.checkStates(fit, base)
|
||||
|
||||
# Old state : New State
|
||||
localMap = {
|
||||
|
||||
Reference in New Issue
Block a user