Skip to content

Commit

Permalink
[1893] Fix exclusion of merge voter for share-only owner
Browse files Browse the repository at this point in the history
Fixes tobymao#10311

In case a player owned shares of the corporation to be created
by merge, the merge step did not regard this as a voter, so the
GUI got stuck. Players had to decline merge to get passed this.

Now merge step considers share owners as well.
  • Loading branch information
perwestling committed Feb 18, 2024
1 parent 8af938d commit b16a2f3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/engine/game/g_1893/step/merger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,19 @@ def round_state
def actions(entity)
return [] if entity.company?
return [] unless choice_available?
return [] if @game.round.merger_candidates_for(@game.round.current_entity).empty?
return [] if mergable_owned.empty? && !merge_target_shares_owned?

ACTIONS
end

def mergable_owned
@game.round.merger_candidates_for(@game.round.current_entity)
end

def merge_target_shares_owned?
@game.round.current_entity.shares.any? { |s| s.corporation == @game.round.merge_target }
end

def description
"Merge of #{@game.round.merge_target.name}"
end
Expand All @@ -48,9 +56,10 @@ def item_str(item)
end

def help
names = @game.round.names(@game.round.merger_candidates_for(@game.round.current_entity))
names = @game.round.names(mergable_owned)
"Vote Yes or No to merge #{names} into #{@game.round.merge_target.name}. " \
'50% Yes votes is required to execute merge. If No votes exceed 50% merge is postponed. ' \
'Shares in Market counts as No vote(s). ' \
'Note! Even if declined, there is an automatic merge at the start of the Merge Round following '\
'the next phase change.'
end
Expand Down

0 comments on commit b16a2f3

Please sign in to comment.