bugfix: Add missing kindof to RailroadGuideAIUpdate - #3360
DrGoldFish1 wants to merge 1 commit into
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. WalkthroughRailroad collision handling now treats faction structures as hostile when ChangesRailroad collision handling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The structure checks cover the relevant kinds in each game variant. No identified issue remains that should delay merging. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 2 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
| #if RETAIL_COMPATIBLE_CRC | ||
| || | ||
| other->isKindOf( KINDOF_FS_INTERNET_CENTER ) || | ||
| other->isKindOf( KINDOF_FS_SUPPLY_CENTER ) || | ||
| other->isKindOf( KINDOF_FS_FAKE ) | ||
| #endif |
There was a problem hiding this comment.
🟡 Medium AIUpdate/RailroadGuideAIUpdate.cpp:260
Non-retail-compatible builds still let trains pass through KINDOF_FS_INTERNET_CENTER, KINDOF_FS_SUPPLY_CENTER, and KINDOF_FS_FAKE structures because these checks are compiled out when RETAIL_COMPATIBLE_CRC == 0. Move the checks outside the conditional compilation guard so the collision fix applies to all supported builds.
-#if RETAIL_COMPATIBLE_CRC
-#endifAlso found in 1 other location(s)
Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp:257
The new
KINDOF_FS_INTERNET_CENTER,KINDOF_FS_SUPPLY_CENTER, andKINDOF_FS_FAKEchecks are entirely inside#if RETAIL_COMPATIBLE_CRC. Any supported non-retail-compatible build withRETAIL_COMPATIBLE_CRC == 0compiles them out, so trains still pass through these structures and the fix does not apply in that build.
🤖 Copy this AI Prompt to have your agent fix this:
In file @GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp around lines 260-265:
Non-retail-compatible builds still let trains pass through `KINDOF_FS_INTERNET_CENTER`, `KINDOF_FS_SUPPLY_CENTER`, and `KINDOF_FS_FAKE` structures because these checks are compiled out when `RETAIL_COMPATIBLE_CRC == 0`. Move the checks outside the conditional compilation guard so the collision fix applies to all supported builds.
Also found in 1 other location(s):
- Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp:257 -- The new `KINDOF_FS_INTERNET_CENTER`, `KINDOF_FS_SUPPLY_CENTER`, and `KINDOF_FS_FAKE` checks are entirely inside `#if RETAIL_COMPATIBLE_CRC`. Any supported non-retail-compatible build with `RETAIL_COMPATIBLE_CRC == 0` compiles them out, so trains still pass through these structures and the fix does not apply in that build.
|
103d8f1 to
a95e04d
Compare
| || | ||
| other->isKindOf( KINDOF_FS_INTERNET_CENTER ) || | ||
| other->isKindOf( KINDOF_FS_SUPPLY_CENTER ) || | ||
| other->isKindOf( KINDOF_FS_FAKE ) |
There was a problem hiding this comment.
How about other->isFactionStructure instead of more mumbo jumbos?
There was a problem hiding this comment.
Made the suggested changes, I also tested these changes and seem to work like intended. Civilian buildings like the tunnel and train station are not effected and all faction buildings die.
a95e04d to
9f4dfa0
Compare
| other->isKindOf(KINDOF_FS_TECHNOLOGY) || | ||
| other->isKindOf(KINDOF_REBUILD_HOLE) | ||
| #if !RETAIL_COMPATIBLE_CRC | ||
| || other->isFactionStructure() |
There was a problem hiding this comment.
Building kinds no longer destroyed
In a non-retail-compatible Generals build, this replacement stops trains from destroying Internet Centers, Supply Centers, and fake buildings. Here, isFactionStructure() checks only the four kinds already listed above it, so it cannot replace the three explicit checks that were removed. When a train hits one of those buildings, the collision handler now returns without destroying it.
| || other->isFactionStructure() | |
| || other->isKindOf(KINDOF_FS_INTERNET_CENTER) || | |
| other->isKindOf(KINDOF_FS_SUPPLY_CENTER) || | |
| other->isKindOf(KINDOF_FS_FAKE) |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
This Pr fixes an issue that allows trains to drive through supplycenters, fakebuildings and internetcenters.
Now they will all get destroyed.
Also this is my first actual fix.
2026-09-25.17-04-07.mp4
2026-09-25.17-02-12.mp4
Fixes #2317