Skip to content

chore(helixcontain): Remove dead code and redundant lookups in HelixContain - #3466

Open
tintinhamans wants to merge 1 commit into
TheSuperHackers:mainfrom
tintinhamans:arctic/refactor/helix-portable-cleanup
Open

tintinhamans wants to merge 1 commit into
TheSuperHackers:mainfrom
tintinhamans:arctic/refactor/helix-portable-cleanup

Conversation

@tintinhamans

@tintinhamans tintinhamans commented Oct 10, 2026 •

Copy link
Copy Markdown

Split out of #3282.

The two destroy blocks sit inside m_portableStructureID == INVALID_ID, where getPortableStructure() is always null. The compiled output is the same with and without them.

removeFromContain and isEnclosingContainerFor looked up the object they were just handed by the ID they had just compared. For a live object that lookup returns the same object, so it is dropped. Caball009 ran this against replays without a mismatch.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 60ecd062-2675-4d72-9d05-ac2e945d1bb2

📥 Commits

Reviewing files that changed from the base of the PR and between 972489b and 41abf62.


📒 Files selected for processing (1)
  • GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HelixContain.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.



Walkthrough

HelixContain no longer destroys the previously referenced portable structure when adding one. Removal clears containment and experience-sink state on the supplied object and resets the stored ID. The enclosure check compares the stored ID with the queried object’s ID.

Changes

Helix containment

Layer / File(s) Summary
Portable-structure ID handling
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HelixContain.cpp
The add methods stop destroying the previously referenced portable structure. Removal clears containment and experience-sink state on the supplied object and resets the stored ID. The enclosure check compares IDs directly.

Priority: ⬇️ Low

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

Change: Refactor

Merge Risk: ⚪ Minimal · up to 41abf

The reviewed changes show no supported behavior regression that needs resolution before merging.

Pre-merge checks | Passed 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the removal of dead code and redundant lookups in HelixContain, which matches the main changeset.
Description check Passed The description explains why the destroy blocks and object lookups can be removed and notes replay testing, so it is directly related to the changeset.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@tintinhamans
tintinhamans requested a review from xezon October 10, 2026 13:07
@greptile-apps

greptile-apps Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issue was found.

Summary

Removes dead destruction blocks and repeated object lookups from HelixContain.

  • HelixContain avoids repeat lookups for its portable structure.

Reviews (5) · Last reviewed commit: "chore(helixcontain): Remove dead code an..." · Reviewed by Greptile

xezon
xezon previously approved these changes Oct 10, 2026

@Caball009 Caball009 left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should be safe. My only mild concern is retail compatible use-after-free bugs invalidating our assumptions about removeFromContain and isEnclosingContainerFor.

I want to test a couple of the replays that previously had me looking at the functions in this class.

@tintinhamans
tintinhamans force-pushed the arctic/refactor/helix-portable-cleanup branch from 0454bdd to 972489b Compare October 10, 2026 20:17
@tintinhamans tintinhamans changed the title refactor(contain): Remove dead code and redundant lookups in HelixContain refactor(contain): Remove dead code in HelixContain Oct 10, 2026
@tintinhamans

Copy link
Copy Markdown
Author

Should be safe. My only mild concern is retail compatible use-after-free bugs invalidating our assumptions about removeFromContain and isEnclosingContainerFor.

I want to test a couple of the replays that previously had me looking at the functions in this class.

Good point, a stale pointer has ID 0 and that would match a Helix without a portable. Took the lookup changes out, it's only the two dead blocks now.

@Caball009
Caball009 dismissed their stale review October 10, 2026 21:01

No issues detected.

@Caball009

Caball009 commented Oct 10, 2026 •

Copy link
Copy Markdown

I just ran the previous changes (including removeFromContain and isEnclosingContainerFor) against a small set of replays and those did not mismatch, so it appears safe to include the previous changes again :)

EDIT: It's up to you whether to include the previous changes again.

@xezon

xezon commented Oct 11, 2026

Copy link
Copy Markdown

You could put them behind RETAIL_COMPATIBLE_CRC if paranoid and put a comment that its just a precaution to leave them.

@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing labels Oct 11, 2026
@xezon xezon changed the title refactor(contain): Remove dead code in HelixContain chore(helixcontain): Remove dead code in HelixContain Oct 11, 2026
@xezon
xezon dismissed their stale review October 11, 2026 18:49

Open comment

@tintinhamans
tintinhamans force-pushed the arctic/refactor/helix-portable-cleanup branch from 972489b to 56e2c32 Compare October 12, 2026 03:12
@tintinhamans tintinhamans changed the title chore(helixcontain): Remove dead code in HelixContain chore(helixcontain): Remove dead code and redundant lookups in HelixContain Oct 12, 2026
@tintinhamans
tintinhamans force-pushed the arctic/refactor/helix-portable-cleanup branch from 56e2c32 to 00b579a Compare October 12, 2026 03:17
@tintinhamans

tintinhamans commented Oct 12, 2026 •

Copy link
Copy Markdown
Author

Should be safe. My only mild concern is retail compatible use-after-free bugs invalidating our assumptions about removeFromContain and isEnclosingContainerFor.

I want to test a couple of the replays that previously had me looking at the functions in this class.

Thanks for testing, put the lookup changes back in. Rebased on #3282.

Added an INVALID_ID check in isEnclosingContainerFor, so a stale pointer with ID 0 can’t match a Helix without a portable.

@tintinhamans
tintinhamans force-pushed the arctic/refactor/helix-portable-cleanup branch from 00b579a to 41abf62 Compare October 12, 2026 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Minor Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants