Skip to content

Fix comparison operator for distance checks#3790

Open
TKTK123456 wants to merge 2 commits intoopenfrontio:mainfrom
TKTK123456:structureMinDist-fix
Open

Fix comparison operator for distance checks#3790
TKTK123456 wants to merge 2 commits intoopenfrontio:mainfrom
TKTK123456:structureMinDist-fix

Conversation

@TKTK123456
Copy link
Copy Markdown

@TKTK123456 TKTK123456 commented Apr 28, 2026

If this PR fixes an issue, link it below. If not, delete these two lines.
Resolves #3737

Description:

Fixing the distance to make it so that structures exactly 15 tiles apart will have rail network.

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
  • I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced

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

tktk1234567
Display name 2TKTK1234567

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 28, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d068ff01-8082-486c-b1bd-0b78a11d4e7a

📥 Commits

Reviewing files that changed from the base of the PR and between 01b3cbe and 81c2764.

📒 Files selected for processing (1)
  • src/core/game/RailNetworkImpl.ts

Walkthrough

Fixes an off-by-one boundary condition error in station distance checks within the railway network logic. The comparison operators are adjusted so structures placed at the minimum allowed distance (15 tiles) can now form railroad connections, aligning placement and connection rules.

Changes

Cohort / File(s) Summary
Rail Network Distance Check Fix
src/core/game/RailNetworkImpl.ts
Updated boundary comparisons from <=/> to </>= in two distance validation loops to treat stations at exactly trainStationMinRange() as eligible for connection, fixing mismatch with structure placement rules.

Estimated Code Review Effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

Rails now reach where distance is exact,
A simple flip of operators brought it back,
Fifteen tiles no longer fall between,
Connections bloom where once they weren't seen,
One fix, two lines, a network complete. 🚂✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: fixing comparison operators used in distance checks.
Description check ✅ Passed The description directly relates to the changeset, explaining the fix for structures at exactly 15 tiles distance forming rail connections.
Linked Issues check ✅ Passed The code changes in RailNetworkImpl.ts directly address issue #3737 by adjusting the two comparison operators to align structure placement with rail connection logic.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the distance comparison operators in RailNetworkImpl.ts as specified in issue #3737.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

Structures at exactly structureMinDist (15 tiles) apart never form railroad connections

2 participants