Conversation
3bd2141 to
4d81449
Compare
4d81449 to
56733ad
Compare
|
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 (1)
💤 Files with no reviewable changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. WalkthroughFive loops in ChangesTerrain deformation loop bounds
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Refactor · Severity of issue fixed: Low Suggested reviewers: Merge Risk: ⚪ Minimal · up to The reduced terrain scans preserve the inspected deformation and map-edge behavior. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: f09a5a66-dc2a-43e9-bde7-23ea259246d2
📒 Files selected for processing (1)
Core/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
|
| Int numSamples = 0; | ||
| for (i=iMin.x; i<=iMax.x; i++) { | ||
| for (j=0; j<=iMax.y; j++) { | ||
| for (j=std::max(0, iMin.y); j<=iMax.y; ++j) { |
There was a problem hiding this comment.
Yes I think so. The original loops started at row 0, but iMin.y can be negative when the shape crosses y=0. In a VC6 retail-compatible build, I tested a Sneak Attack tunnel near that edge; removing the clamp changed the terrain height, the tunnel's z and the game CRC on the next frame. The clamp preserves the original lower bound.
There was a problem hiding this comment.
That said, normal player placement appears to prevent it. Scripted or directly spawned objects can still reach it. Seems good to keep it imho
There was a problem hiding this comment.
Ok. Can we move the clamping out of the loop and then put it behind RETAIL_COMPATIBLE_CRC?
There was a problem hiding this comment.
Moved the clamp before the loops and put it behind RETAIL_COMPATIBLE_CRC.
There was a problem hiding this comment.
I moved the clamp, but greptile has a complaint. Are we ok with that for non-retail behavior?
There was a problem hiding this comment.
There are 2 possibilities for non-retail:
- clamp min and max coords at map bounds
- Do not clamp min and max coords at map bounds
Retail only clamps min, but not max.
I suggest test how it looks in game with clamping and not clamping at the map edges.
There was a problem hiding this comment.
…il compatibility only
| for (Int i = iMin.x; i <= iMax.x; i++ ) | ||
| { | ||
| for ( Int j=0; j <= iMax.y; j++ ) | ||
| for ( Int j=iMin.y; j <= iMax.y; ++j ) |
There was a problem hiding this comment.
Negative rows enter terrain scans
If RETAIL_COMPATIBLE_CRC is disabled, a crater or structure whose footprint crosses the lower map edge now starts scanning at a negative row. The same change affects the flattening loops. Those rows were previously skipped; now they can change the height samples used for flattening and, on maps with a height-map border, allow terrain writes into border cells.

createCraterInTerrainandflattenTerraincalculateiMin.y, but their inner loops start at row 0. The shape checks reject rows outside the affected area, so this wastes more work as the Y position increases.Now starts the loops at
iMin.y. Retail compatible builds clampiMin.yto 0 before the loops to keep the original lower bound and CRC. Without retail compatibility, rows below 0 are processed the same way columns below 0 already are.Todo: