[18India] Fix GIPR bond conversion: manager and float#12695
Open
ddaybell wants to merge 1 commit into
Open
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collaborator
|
There is a template for PRs. Should you not be using that for your PRs? Also, decide if [18India] or [18 India] should be used in the titles. You can also label all 18 India PRs with the 18 India label. If they also requires pin or archive, those are good labels as well to use. There are other labels that could possibly also be used. |
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.
Bond shares in GIPR are created outside the normal IPO system, which caused two bugs when players converted Railroad Bonds.
#11289 - Crash on bond conversion if nobody was GIPR manager yet (undefined method 'percent_of' for nil):
convert_bond_to_gipr called check_manager_change, which accessed gipr.owner.percent_of(...). If no normal GIPR share had been purchased yet, gipr.owner is nil and the game crashes. Fixed by calling make_manager on the converting player when GIPR has no manager yet, mirroring what normal share purchases already do.
#11242 - GIPR doesn't float when exchanging bonds:
Bond shares bypass the IPO, so @ipo_owner.percent_of(self) never decreases from bond conversions and the standard floated? check never fires. Fixed with a new check_gipr_float method in game.rb that sums share_holders directly - capturing both normal IPO sales and bond conversions - and explicitly sets floated and calls float_corporation when the 30% threshold is reached. The percent_to_float display on the charter was also incorrect for the same reason; fixed with an override in Corporation using the same share_holders approach.
Home token placement after a bond-triggered float is handled in process_choose in the step, following the same pattern as normal share purchases.
Closes #11289, #11242.