Skip to content

Commit

Permalink
Only allow laying track when it's legal to. Fixes #13.
Browse files Browse the repository at this point in the history
  • Loading branch information
hcarver committed Apr 10, 2020
1 parent 4cd24b2 commit da477d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions assets/js/view/hex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def render
children << h(Tile, tile: @tile) if @tile
children << h(View::TriangularGrid) if @show_grid
layable = @round.layable_hexes.key?(@hex) if @round.respond_to?(:layable_hexes)
layable &&= @round.can_lay_track? if @round.respond_to?(:can_lay_track?)

clickable = layable || @role == :tile_selector

props = {
Expand Down
4 changes: 4 additions & 0 deletions lib/engine/round/operating.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ def can_sell?(shares)
remaining >= next_highest
end

def can_lay_track?
@step == :track
end

def next_step!
current_index = self.class::STEPS.find_index(@step)

Expand Down

0 comments on commit da477d9

Please sign in to comment.