Skip to content

Commit

Permalink
Merge pull request #11564 from tobymao/1844-unable-to-lay-tile
Browse files Browse the repository at this point in the history
[1844] Fix destination logic
  • Loading branch information
crericha authored Feb 19, 2025
2 parents 261f962 + 18a762f commit 4fa1406
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/engine/game/g_1844/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,9 @@ def all_potential_upgrades(tile, tile_manifest: false, selected_company: nil)
end

def destinated?(entity)
home_node = hex_by_id(entity.coordinates).cities.find { |c| c.tokened_by?(entity) || c.reserved_by?(entity) }
return false unless entity.coordinates

home_node = hex_by_id(entity.coordinates).tile.cities.find { |c| c.tokened_by?(entity) || c.reserved_by?(entity) }
destination_hex = hex_by_id(entity.destination_coordinates)
return false if !home_node || !destination_hex
return false unless destination_hex.assigned?(entity)
Expand Down

0 comments on commit 4fa1406

Please sign in to comment.