Skip to content

Removed the ability for rails to cross impassible terrain - #4903

Merged
FloPinguin merged 1 commit into
openfrontio:mainfrom
TKTK123456:rail-lines-crossing-impassible-terrain
Aug 7, 2026
Merged

Removed the ability for rails to cross impassible terrain#4903
FloPinguin merged 1 commit into
openfrontio:mainfrom
TKTK123456:rail-lines-crossing-impassible-terrain

Conversation

@TKTK123456

Copy link
Copy Markdown
Contributor

Before opening a PR: discuss new features on Discord first, and file bugs or small improvements as issues. You must be assigned to an approved issue — unsolicited PRs will be auto-closed.

Add approved & assigned issue number here:

Resolves #4902

Description:

Removed the ability for rails to cross impassible terrain
Before:
image
After:
image

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory

Please put your Discord username so you can be contacted if a bug or regression is found:

tktk1234567

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Rail pathfinding now checks whether the current node is impassable. Traversal stops immediately for impassable sources. Existing water and shoreline rules remain unchanged.

Changes

Rail traversal rules

Layer / File(s) Summary
Block traversal from impassable nodes
src/core/pathfinding/algorithms/AStar.Rail.ts
Neighbor generation evaluates source-node impassability once and passes it to directional traversal checks. isTraversable rejects impassable sources before applying existing terrain rules.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: evanpelle

Poem

Rails meet a rocky line,
Then stop before they cross.
Water rules still stand,
Shorelines keep their course.
Impassable ground says “no”—
The path now knows the loss.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: preventing rails from crossing impassible terrain.
Description check ✅ Passed The description directly explains the rail change and links it to issue #4902.
Linked Issues check ✅ Passed The change rejects rail traversal when the source node is impassible, meeting issue #4902's expected behavior.
Out of Scope Changes check ✅ Passed The changes are limited to rail pathfinding behavior and are directly related to issue #4902.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/core/pathfinding/algorithms/AStar.Rail.ts`:
- Around line 55-86: Add regression coverage in PathFinding.Rail.test.ts for the
rail pathfinding behavior around isTraversable: verify an impassable source, a
passable node adjacent to an impassable node, and a route that would otherwise
cross impassable terrain. Keep the existing adjacent land-to-land case and
assert that impassable nodes are never included in returned paths.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 35f0deb9-5007-4dde-a217-2f4d767e1bf3

📥 Commits

Reviewing files that changed from the base of the PR and between e08c64c and 63ad719.

📒 Files selected for processing (1)
  • src/core/pathfinding/algorithms/AStar.Rail.ts

Comment thread src/core/pathfinding/algorithms/AStar.Rail.ts
@github-project-automation github-project-automation Bot moved this from Triage to Development in OpenFront Release Management Aug 7, 2026
@FloPinguin FloPinguin added this to the v34 milestone Aug 7, 2026

@FloPinguin FloPinguin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@github-project-automation github-project-automation Bot moved this from Development to Final Review in OpenFront Release Management Aug 7, 2026
@FloPinguin
FloPinguin added this pull request to the merge queue Aug 7, 2026
Merged via the queue into openfrontio:main with commit f01aaf9 Aug 7, 2026
12 of 13 checks passed
@github-project-automation github-project-automation Bot moved this from Final Review to Complete in OpenFront Release Management Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

Rail lines can cross impassible terrain

2 participants