startMoney check should be >= moneyMax, not ==

Just realized that I checked for exactly equal (as would be likely when operating internally), but really, it should treat anything greater than or equal to as a zero growth scenario (just better protection from a wider range of potential issues)
This commit is contained in:
zeddrak 2022-02-01 14:34:27 -08:00 committed by GitHub
parent 5cc7a6a0a2
commit bfaecc644d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -106,7 +106,7 @@ export function numCycleForGrowthTransition(server: Server, growth: number, p: I
* @returns Number of "growth cycles" needed
*/
export function numCycleForGrowthCorrected(server: Server, targetMoney: number, startMoney: number, p: IPlayer, cores = 1): number {
if (startMoney == server.moneyMax) { return 0; } //no growth possible, no threads needed
if (startMoney >= server.moneyMax) { return 0; } //no growth possible, no threads needed
if (startMoney < 0) { startMoney = 0; } // servers "can't" have less than 0 dollars on them
if (targetMoney > server.moneyMax) { targetMoney = server.moneyMax; } // can't grow a server to more than its moneyMax