Skip to content

Commit

Permalink
Implement a version of ShadowTheAge#181, allowing XXb to specify XX b…
Browse files Browse the repository at this point in the history
…elts of production. (#128)

Also look for /s, /m, or /h suffixes. If present, use that suffix
regardless of the current display settings.

The objectives of this change are:
* Allow specifying a certain number of belts of production or
consumption, by typing "XXb"
* Correctly parse /s, /m, and /h suffixes, regardless of the current
display preferences.
* Preserve existing behavior with regards to case sensitivity and
bare-number input:
  * Preserve mW == MW for now
* "100" still means 100 of whatever unit is normally displayed in that
box.
* Be as permissive as reasonable about whitespace. (More permissive than
I intended, to allow parsing the "10 000" output from calling
`FormatValue(..., precise: true)`)
* Correctly parse any string YAFC can display:
* Allow p and /t suffixes when they have meanings in the preferences.
(That said, /t always has a meaning.)
* Fix the bug that "10W" is parsed as ten megawatts instead of ten
watts.
* Prevent use of non-applicable units or garbage input:
* No reporting you built "5/m" buildings or "30%" beacons, and no
sticking a "?" anywhere in your input.
* On the other hand, do allow "+15e+4", which is valid formatting for a
float.
  • Loading branch information
shpaass authored May 14, 2024
2 parents 96a2173 + a3b991d commit 6a28abf
Show file tree
Hide file tree
Showing 4 changed files with 514 additions and 44 deletions.
Loading

0 comments on commit 6a28abf

Please sign in to comment.