Skip to content

[Core/Graph] Unnecessary graph computation for :permissive games #12808

Description

@ollybh

Step::Tracker.check_track_restrictions! checks that track added on a new tile is part of the laying corporation's network, unless TRACK_RESTRICTION is :permissive. However, the way this function is structured means that we always check the game graph for connection to new track, even for :permissive games. As a new tile is being laid accessing graph.connected_paths will end up calling graph.compute.

This computation could be avoided by adding a return if @game.class::TRACK_RESTRICTION == :permissive guard at the start of the function.

This is something I noticed whilst looking at graph code, recording it here so it's not forgotten…

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions