Skip to content

Fix comparison operator for distance checks#3790

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

Fix comparison operator for distance checks#3790
TKTK123456 wants to merge 4 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: 97868fe1-fc70-40c5-96cf-e322857e29e1

📥 Commits

Reviewing files that changed from the base of the PR and between 81c2764 and 5c162ab.

📒 Files selected for processing (1)
  • src/core/game/RailNetworkImpl.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/core/game/RailNetworkImpl.ts

Walkthrough

Adjusts two distance-comparison operators in the rail network so stations exactly at the configured minimum range are considered eligible for ghost path creation and actual connections, aligning connection logic with structure placement rules.

Changes

Cohort / File(s) Summary
Rail network distance comparisons
src/core/game/RailNetworkImpl.ts
Modified two comparison operators: changed <= minRangeSquared to < minRangeSquared in ghost-path filtering, and > minRangeSquared to >= minRangeSquared in neighbor connection gating so equal-distance stations are allowed to link.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

Lines flipped, the gap is small —
Fifteen tiles now heed the call,
Ghosts connect and rails align,
Two small signs, one changed design,
Tracks meet true where structures sprawl. 🚂

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: fixing comparison operators for distance checks in rail network code.
Description check ✅ Passed The description is related to the changeset, explaining that the fix enables structures exactly 15 tiles apart to form rail networks.
Linked Issues check ✅ Passed The code changes directly address issue #3737 by changing the two comparison operators as suggested: <= to < and > to >= in RailNetworkImpl.ts.
Out of Scope Changes check ✅ Passed The changes are narrowly scoped to fixing the distance comparison operators in RailNetworkImpl.ts, directly addressing the linked issue without introducing unrelated modifications.
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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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