Reject non-positive bank amounts and fix stale crew/interest dialogue - #167
Merged
dmccoystephenson merged 1 commit intoAug 3, 2026
Merged
Conversation
- Bank deposit/withdraw now reject amounts <= 0, closing the exploit where a negative deposit minted cash and wrote a save the game would refuse to load on the next launch. - The bank teller's interest-rate dialogue now states the actual capped rule (rate and daily cap) instead of the uncapped "the more you save, the more you earn" line. - A crew NPC's "berths full" dialogue and its unlock condition now use fleet-wide totalCrewBerths() instead of the best hull's maxWorkers, so it no longer tells a player to buy a bigger boat while another boat in their fleet still has open berths. Closes #149, #152, #158 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric:
Summary: three small, independent bug fixes (bank negative-amount exploit, stale crowded-crew dialogue, stale interest-rate dialogue), each with a regression test proven to fail before the fix and pass after. drafted by Claude on behalf of Daniel Stephenson |
dmccoystephenson
deleted the
fix/bank-negative-amounts-and-dialogue-drift
branch
August 3, 2026 08:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three small, independent bugs found during triage are addressed here.
Bank.deposit()/Bank.withdraw(). A negative deposit passedcanAfford()(money >= a negative number is always true) and minted cash, while a negative withdrawal droveplayer.moneynegative — both wrote a save thatschemas/player.json's"minimum": 0constraint would reject on the next load. Non-positive amounts are now rejected with a re-prompt, mirroring the existingis Noneretry branch.maxWorkers, even though hiring has been fleet-wide (boats.totalCrewBerths) since a prior change. A player with a second boat and open berths was told to buy a bigger boat while hiring still worked normally. Both the condition and the response text are now derived fromtotalCrewBerths, matching the README's documented "one shared roster" rule.MAX_INTEREST_PER_DAYwas introduced to cap the daily payout. The line is now derived fromINTEREST_RATE/MAX_INTEREST_PER_DAYso it states the real rule and the point at which it caps, and can't drift from the constants again.The broader, structural write-side validation this triage also flagged (unvalidated writes letting an invalid save land on disk at all) is left to #160, which is a materially larger change touching
saveFileManager.py/*JsonReaderWriter.py.Issues deferred this cycle
The rest of the open backlog is deferred without further comment, since this cycle's scope was kept to three small, low-risk fixes: #160 (save-write atomicity/validation — large, touches protected save-path files), #156 (voyage-event test coverage — a sizeable standalone test-expansion effort), #153 (web front-end "ended" screen), #151 (overnight report dropped at three call sites), #150 (corrupt save vanishing from the menu), #143 and #142 (save/load error reporting).
Test plan
python3 -m compileall -q src731 passedunder headless SDL drivers (SDL_VIDEODRIVER=dummy,SDL_AUDIODRIVER=dummy)Closes #149
Closes #152
Closes #158
This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).