Round results a little to get rid of float error

This commit is contained in:
DarkPhoenix
2019-08-21 11:38:14 +03:00
parent 2d96af9fc8
commit 1b2cd62629
2 changed files with 4 additions and 3 deletions

View File

@@ -36,6 +36,7 @@ from eos.saveddata.character import Character
from eos.saveddata.citadel import Citadel
from eos.saveddata.module import Module
from eos.saveddata.ship import Ship
from eos.utils.float import floatUnerr
from eos.utils.stats import DmgTypes, RRTypes
@@ -1316,13 +1317,13 @@ class Fit:
self.__savedCapSimData[startingCap] = []
return None
def getCapGainFromMod(self, mod):
def getCapRegenGainFromMod(self, mod):
"""Return how much cap regen do we gain from having this module"""
currentRegen = self.calculateCapRecharge()
nomodRegen = self.calculateCapRecharge(
capacity=self.ship.getModifiedItemAttrWithoutAfflictor("capacitorCapacity", mod),
rechargeRate=self.ship.getModifiedItemAttrWithoutAfflictor("rechargeRate", mod) / 1000.0)
return currentRegen - nomodRegen
return floatUnerr(currentRegen - nomodRegen)
def getRemoteReps(self, spoolOptions=None):
if spoolOptions not in self.__remoteRepMap:

View File

@@ -446,7 +446,7 @@ class Miscellanea(ViewColumn):
return text, tooltip
elif itemGroup in ("Capacitor Recharger", "Capacitor Power Relay", "Capacitor Battery"):
fit = Fit.getInstance().getFit(self.fittingView.getActiveFit())
capGain = fit.getCapGainFromMod(stuff)
capGain = fit.getCapRegenGainFromMod(stuff)
if not capGain:
return "", None
text = formatAmount(capGain, 3, 0, 3, forceSign=True)