Conversation
Modifies how `getActorCurrencyUpdates` works to now perform additional passes in an attempt to find the correct currency to deduce without resulting in a remainder. Previously, if you had a character with 100 gp, 5 sp, and 20 cp, and you asked to deduce 100 cp, it would return a remainder of 30 despite having enough currency to complete the request. This is because the loop would start at the lowest currency (100 - 20 = 80), then go to the next currency up (80 - (5 * 10) = 30), and then continue up through the denominations not finding any more that would be able to be deducted. This change causes it to instead perform several loops over the list of currencies. If on the first pass ends with a remainder, then it will move the first entry in the currencies list to the end and re-perform the calculation. It will continue until it ends up with a remainder of `0` or has used each currency denomination as its first entry. Closes #6627
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.
Modifies how
getActorCurrencyUpdatesworks to now perform additional passes in an attempt to find the correct currency to deduce without resulting in a remainder. Previously, if you had a character with 100 gp, 5 sp, and 20 cp, and you asked to deduce 100 cp, it would return a remainder of 30 despite having enough currency to complete the request. This is because the loop would start at the lowest currency (100 - 20 = 80), then go to the next currency up (80 - (5 * 10) = 30), and then continue up through the denominations not finding any more that would be able to be deducted.This change causes it to instead perform several loops over the list of currencies. If on the first pass ends with a remainder, then it will move the first entry in the currencies list to the end and re-perform the calculation. It will continue until it ends up with a remainder of
0or has used each currency denomination as its first entry.Closes #6627