Allow zero amount debit and credit operations #112

Merged
40435022 merged 1 commit from cadhan/debit_credit_fix into dev 2026-01-17 23:32:29 +00:00
40435022 commented 2026-01-17 23:31:25 +00:00 (Migrated from gitlab.eeecs.qub.ac.uk)

Zero balance scenarios no longer will crash by allowing debit(0) and credit(0) to be zero operations. Several square effects use Math.min(amount, balance) and will pass 0 when a player has no money. The previous debit and credit methods would throw errors on 0, which would have caused crashes.

  • Player.debit and Player.credit now reject only negative amounts. Passing in 0 no longer gets rejected and just doesn't change the balance.
  • No gameplay logic changes other than this
Zero balance scenarios no longer will crash by allowing debit(0) and credit(0) to be zero operations. Several square effects use Math.min(amount, balance) and will pass 0 when a player has no money. The previous debit and credit methods would throw errors on 0, which would have caused crashes. - Player.debit and Player.credit now reject only negative amounts. Passing in 0 no longer gets rejected and just doesn't change the balance. - No gameplay logic changes other than this
40457809 (Migrated from gitlab.eeecs.qub.ac.uk) approved these changes 2026-01-17 23:31:25 +00:00
40435022 commented 2026-01-17 23:31:26 +00:00 (Migrated from gitlab.eeecs.qub.ac.uk)

requested review from @40441512, @40446360, @40439721, @40444856, @40441188, and @40457809

requested review from @40441512, @40446360, @40439721, @40444856, @40441188, and @40457809
40435022 commented 2026-01-17 23:31:26 +00:00 (Migrated from gitlab.eeecs.qub.ac.uk)

assigned to @40435022

assigned to @40435022
40435022 (Migrated from gitlab.eeecs.qub.ac.uk) scheduled this pull request to auto merge when all checks succeed 2026-01-17 23:31:47 +00:00
40457809 commented 2026-01-17 23:32:28 +00:00 (Migrated from gitlab.eeecs.qub.ac.uk)

approved this merge request

approved this merge request
40435022 commented 2026-01-17 23:32:30 +00:00 (Migrated from gitlab.eeecs.qub.ac.uk)

mentioned in commit 6801c28043

mentioned in commit 6801c280438c3e18ea1bec280133f050d6206c99
40435022 (Migrated from gitlab.eeecs.qub.ac.uk) merged commit 6801c28043 into dev 2026-01-17 23:32:30 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
owenryan/carbonopoly!112
No description provided.