Skip to content

refactor: Port Generals hash map code for Object and Drawable lookups to Zero Hour (2) - #3470

Open
Caball009 wants to merge 4 commits into
TheSuperHackers:mainfrom
Caball009:Caball009/tweak_object_drawable_hashmaps
Open

Caball009 wants to merge 4 commits into
TheSuperHackers:mainfrom
Caball009:Caball009/tweak_object_drawable_hashmaps

Conversation

@Caball009

@Caball009 Caball009 commented Oct 10, 2026 •

Copy link
Copy Markdown

This PR is another attempt to port the Generals hash map code to Zero Hour for Object and Drawable. I copied the Generals code to Zero Hour and discarded the code that was already there (but commented out).

This was previously done and reverted because it introduced mismatches. I can reproduce the mismatches with 4fe88de, but not with this branch. This suggests that the change was safe but ran into an uninitialized variable that wasn't discovered yet. I've also tested 2000+ replays with the hash map changes and saw no mismatch because of them.

See commits for (mostly) clean diffs. All Zero Hour changes are ported from Generals.

@Caball009 Caball009 added Minor Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour Refactor Edits the code with insignificant behavior changes, is never user facing Memory Is memory related labels Oct 10, 2026
@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: 6d5252a0-134c-4631-94d3-da91f78de7b7

📥 Commits

Reviewing files that changed from the base of the PR and between 0405d02 and 2fdfcbd.


📒 Files selected for processing (2)
  • Generals/Code/GameEngine/Source/GameClient/GameClient.cpp
  • GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp

💤 Files with no reviewable changes (2)
  • Generals/Code/GameEngine/Source/GameClient/GameClient.cpp
  • GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp

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



Walkthrough

GameClient and GameLogic replace vector-based ID lookup with hash maps. Drawable and object registration, removal, reset, and lookup now use the hash maps. The drawable cleanup loop declaration and lookup-table comments also change.

Changes

ID-based lookup storage

Layer / File(s) Summary
Drawable lookup hash map
GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h, GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp, Generals/Code/GameEngine/Source/GameClient/GameClient.cpp
GameClient enables drawable hash-map types and storage. Reset, lookup, registration, and removal use the map. The drawable cleanup loop declares its pointers in the loop initializer. Comments describe the drawable lookup table.
Game-object lookup hash map
GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h, GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp, Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
GameLogic enables object hash-map types and storage. Lookup, registration, removal, reset, and destruction use the map. A comment now refers to the lookup table.

Priority: ⬇️ Low

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

Change: Refactor

Merge Risk: ⚪ Minimal · up to 2fdfc

No actionable lookup regression was established; the change is mergeable after normal checks.

Pre-merge checks · Passed 4
Passed Passed checks (4 passed)
Check name Status Explanation
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.
Title check Passed The title clearly identifies the main change: porting hash map lookups for Objects and Drawables to Zero Hour. It is specific and related to the changeset.
Description check Passed The description accurately explains the hash map port, its history, mismatch testing, replay testing, and source of the Zero Hour changes.

  • 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.

@Caball009 Caball009 added the Unify Unifies code between Generals and Zero Hour label Oct 12, 2026
@Caball009
Caball009 force-pushed the Caball009/tweak_object_drawable_hashmaps branch from e888102 to 0405d02 Compare October 12, 2026 19:20
@Caball009
Caball009 marked this pull request as ready for review October 12, 2026 19:32
@greptile-apps

greptile-apps Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[High impact] The PR appears safe to merge, with the previous finding fixed and no new issues found.

Summary

The PR replaces Zero Hour’s object and drawable lookup vectors with hash maps, following the Generals implementation.

  • Object IDs now lead to their objects through a hash map.
  • Drawable IDs now lead to their drawables through a hash map.

Reviews (2) · Last reviewed commit: "Addressed feedback." · Reviewed by Greptile

Comment thread GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Memory Is memory related Minor Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing Unify Unifies code between Generals and Zero Hour ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant