Mission Controller 2

Mission Controller 2

32k Downloads

Possible incorrect calculation of funds in RepairContracts.cs

etmoonshade opened this issue ยท 2 comments

commented

In MCEContracts\RepairContracts.cs, I noticed the following:

(edit: Tried enclosing the following in code brackets, and it made an utter mess of it.)

if (maxApA <= 120000)
{
base.SetFunds(20000 * HighLogic.CurrentGame.Parameters.CustomParams<MCE_IntergratedSettings3>().MCEContractPayoutMult, 71000f * HighLogic.CurrentGame.Parameters.CustomParams<MCE_IntergratedSettings3>().MCEContractPayoutMult, 150000f * HighLogic.CurrentGame.Parameters.CustomParams<MCE_IntergratedSettings3>().MCEContractPayoutMult, targetBody);
base.SetReputation(20f, 25f, targetBody);
}
if (maxApA > 120000 && maxApA <= 1000000)
{
base.SetFunds(25000 * HighLogic.CurrentGame.Parameters.CustomParams<MCE_IntergratedSettings3>().MCEContractPayoutMult, 95000f * HighLogic.CurrentGame.Parameters.CustomParams<MCE_IntergratedSettings3>().MCEContractPayoutMult, 210000f * HighLogic.CurrentGame.Parameters.CustomParams<MCE_IntergratedSettings3>().MCEContractPayoutMult, targetBody);
base.SetReputation(20f, 25f, targetBody);
}
if (maxApA > 30000)
{
base.SetFunds(2500 * HighLogic.CurrentGame.Parameters.CustomParams<MCE_IntergratedSettings3>().MCEContractPayoutMult, 35000 * HighLogic.CurrentGame.Parameters.CustomParams<MCE_IntergratedSettings3>().MCEContractPayoutMult, 35000 * HighLogic.CurrentGame.Parameters.CustomParams<MCE_IntergratedSettings3>().MCEContractPayoutMult, targetBody);
base.SetReputation(20f, 25f, targetBody);
}

It looks like that last "if" statement will basically overwrite nearly ANY repair contract, even in stock? Not that I remember what the
atmosphere height in stock is anymore. :V

Now that I look at the atmosphere height in stock (70km,) I'm not even sure WHAT this was supposed to catch. It also looks like any contract with a target ApA of more than 1Mm would result in undefined behavior?

It's entirely possible that I'm misreading how this works, and there's something I don't understand. I figured I'd point this out just in case though - I was looking for something else, stumbled across this, and thought it looked odd.

commented

ya it should be 300,000. Not sure what I was doing here. it all needs to be redone.

commented

Fixed this in 3.1.2.0. Quick fix but works, and repair contracts now pay out pretty good even better at higher orbits!