Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Grow log shows invalid values in edge cases #1872

Conversation

catloversg
Copy link
Contributor

@catloversg catloversg commented Dec 22, 2024

In 23c862b, we fixed the case in which ns.grow returns Infinity. On Discord, we received a report that terminal grow shows NaN%. When I checked the implementation of processSingleServerGrowth and its callers, I found more bugs:

  • On servers with maxMoney = 0:
    • Terminal grow shows NaN.
    • ns.grow shows "-100%".
  • On "grow-able" servers: Terminal grow shows Infinity if server's money before growing is 0.

I carefully refactored code of processSingleServerGrowth and its callers so that there is no behavior change in ns.grow.

Before:
before1
before2
before3

After:
after1
after2
after3

src/NetscriptFunctions.ts Outdated Show resolved Hide resolved
Co-authored-by: David Walker <[email protected]>
@d0sboots d0sboots merged commit 8c19165 into bitburner-official:dev Jan 9, 2025
5 checks passed
@catloversg catloversg deleted the pull-request/bugfix/grow-log-shows-invalid-values-in-edge-cases branch January 9, 2025 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants