Skip to content

unify(thingtemplate): Merge and move ThingTemplate to Core - #3324

Merged
xezon merged 2 commits into
TheSuperHackers:mainfrom
OmarAglan:unify/thingtemplate-editor-accessors
Sep 26, 2026
Merged

xezon merged 2 commits into
TheSuperHackers:mainfrom
OmarAglan:unify/thingtemplate-editor-accessors

Conversation

@OmarAglan

@OmarAglan OmarAglan commented Sep 20, 2026 •

Copy link
Copy Markdown

Merge with Rebase

Merges the Generals and Zero Hour ThingTemplate implementations using Zero Hour as the baseline, then moves the shared header and source to Core in preparation for the WorldBuilder merge.

  • Aligns template fields, accessors, module metadata and INI parsing.
  • Shares Zero Hour’s build-limit parser and OverrideableByLikeKind handling.
  • Preserves Generals’ default auto-heal inheritance under RETAIL_COMPATIBLE_CRC.
  • Keeps legacy Generals audio fields under RTS_GENERALS && RETAIL_COMPATIBLE_DATA, with identical guarded death-sound blocks in both Object.cpp files.
  • Aligns the required Generals GameLogic and Player interfaces.

Validation:

  • VC6 Release builds passed for both games and both WorldBuilders.
  • git diff --check passed.

"i used some AI assistance in analysis and validation"

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

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: 614cc81e-72a2-4508-9c64-fbe0f91d3584

📥 Commits

Reviewing files that changed from the base of the PR and between d182473 and 02db325.

📒 Files selected for processing (4)
  • Core/GameEngine/Include/Common/ThingTemplate.h
  • Core/GameEngine/Source/Common/Thing/ThingTemplate.cpp
  • Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp
  • scripts/cpp/unify_move_files.py

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

The change enables the Core ThingTemplate implementation, removes duplicate Generals implementations, adds conditional death-audio APIs, applies platform-specific parsing rules, and uses template calculation methods for vision ranges.

Changes

ThingTemplate platform integration

Layer / File(s) Summary
ThingTemplate build integration
Core/GameEngine/CMakeLists.txt, Generals/Code/GameEngine/..., GeneralsMD/Code/GameEngine/..., scripts/cpp/unify_move_files.py
The Core build includes ThingTemplate. The Generals and GeneralsMD builds no longer include their duplicate files. The file-unification script moves the files into Core.
ThingTemplate API and range calculation
Core/GameEngine/Include/Common/ThingTemplate.h, Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp, Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp
ThingTemplate adds conditional death and crush audio entries and accessors. Object and BuildAssistant use template calculation methods for vision-related ranges. Death audio playback is conditional on RTS_GENERALS && RETAIL_COMPATIBLE_DATA.
Platform-specific template behavior
Core/GameEngine/Source/Common/Thing/ThingTemplate.cpp
Template parsing, copied-module cleanup, AI module replacement, audio validation, superweapon restrictions, and instant-build behavior use platform-specific conditions.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Refactor

🚥 Pre-merge checks | ✅ 4
✅ 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 describes the main change: merging and moving ThingTemplate into Core.
Description check ✅ Passed The description directly explains the ThingTemplate merge, relocation, platform-specific behavior, and validation results.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai
coderabbitai Bot requested a review from xezon September 20, 2026 08:28
@greptile-apps

greptile-apps Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[High risk] Moves core game object template code between build targets.

The PR appears safe to merge based on this re-review.

Summary

The PR moves the Zero Hour ThingTemplate implementation into Core for use by both games, adds Generals compatibility guards, and updates the affected build and game interfaces. There are no code changes since the previous review.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  T[Core ThingTemplate] --> G[Generals GameEngine]
  T --> Z[Zero Hour GameEngine]
Loading

Reviews (10) · Last reviewed commit: "unify(thingtemplate): Move ThingTemplate..."

@xezon xezon 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.

There are a lot more things in ThingTemplate that can be merged. Maybe merge the whole thing?

@OmarAglan

Copy link
Copy Markdown
Author

There are a lot more things in ThingTemplate that can be merged. Maybe merge the whole thing?

i do agree, but it will be huge unrelated change as i need those specific changes for the world builder to get merged, but i will see what i can do

@xezon

xezon commented Sep 20, 2026

Copy link
Copy Markdown

I looked over ThingTemplate and it is relevatively low level. So it seems possible to merge the whole thing.

@OmarAglan

OmarAglan commented Sep 20, 2026 •

Copy link
Copy Markdown
Author

I looked over ThingTemplate and it is relevatively low level. So it seems possible to merge the whole thing.

yes on it, will update the pr soon.

OmarAglan added a commit to OmarAglan/GeneralsGameCode that referenced this pull request Sep 20, 2026
OmarAglan added a commit to OmarAglan/GeneralsGameCode that referenced this pull request Sep 20, 2026
@OmarAglan
OmarAglan force-pushed the unify/thingtemplate-editor-accessors branch from 1df0d09 to d182473 Compare September 20, 2026 15:38
@coderabbitai
coderabbitai Bot requested a review from bobtista September 20, 2026 15:39
@OmarAglan OmarAglan changed the title unify(thingtemplate): Align editor facing accessors unify(thingtemplate): Merge and move ThingTemplate to Core Sep 20, 2026
Comment thread Core/GameEngine/Include/Common/ThingTemplate.h Outdated
Comment thread GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp Outdated
OmarAglan added a commit to OmarAglan/GeneralsGameCode that referenced this pull request Sep 21, 2026
OmarAglan added a commit to OmarAglan/GeneralsGameCode that referenced this pull request Sep 21, 2026
@OmarAglan
OmarAglan force-pushed the unify/thingtemplate-editor-accessors branch from d182473 to 02db325 Compare September 21, 2026 08:09

@xezon xezon 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.

This change has a number of RTS_GENERALS and RTS_ZEROHOUR defines. Are all of these justified?

Comment thread GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp Outdated
Comment thread GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp Outdated
Comment thread GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp Outdated
@OmarAglan

Copy link
Copy Markdown
Author

This change has a number of RTS_GENERALS and RTS_ZEROHOUR defines. Are all of these justified?

i try to keep both games as pure as possible, without adding things from zerohour to gen or vice versa, is it possible to port some of guarded things to gen, if needed.

OmarAglan added a commit to OmarAglan/GeneralsGameCode that referenced this pull request Sep 21, 2026
OmarAglan added a commit to OmarAglan/GeneralsGameCode that referenced this pull request Sep 21, 2026
@OmarAglan
OmarAglan force-pushed the unify/thingtemplate-editor-accessors branch from 02db325 to 4040697 Compare September 21, 2026 08:52
@xezon

xezon commented Sep 21, 2026

Copy link
Copy Markdown

Some guidelines for merging:

  1. Code in Zero Hour takes precendence over Generals.
  2. Zero Hour can inherit things from Generals if they are better than what Zero Hour does.
  3. Generals generally inherits everything from Zero Hour.
  4. Generals and Zero Hour retail runtime logic, xfer and data compatibility must not change with RETAIL_COMPATIBLE_CRC, RETAIL_COMPATIBLE_XFER_SAVE, RETAIL_COMPATIBLE_DATA.
  5. Generals visuals can change if it comes as an improvement from Zero Hour.

It is the job of a merge to merge as much as is possible while not violating the above.

OmarAglan added a commit to OmarAglan/GeneralsGameCode that referenced this pull request Sep 21, 2026
OmarAglan added a commit to OmarAglan/GeneralsGameCode that referenced this pull request Sep 21, 2026
@OmarAglan
OmarAglan force-pushed the unify/thingtemplate-editor-accessors branch from 4040697 to f3a482f Compare September 21, 2026 14:46
@OmarAglan

Copy link
Copy Markdown
Author

Some guidelines for merging:

  1. Code in Zero Hour takes precendence over Generals.
  2. Zero Hour can inherit things from Generals if they are better than what Zero Hour does.
  3. Generals generally inherits everything from Zero Hour.
  4. Generals and Zero Hour retail runtime logic, xfer and data compatibility must not change with RETAIL_COMPATIBLE_CRC, RETAIL_COMPATIBLE_XFER_SAVE, RETAIL_COMPATIBLE_DATA.
  5. Generals visuals can change if it comes as an improvement from Zero Hour.

It is the job of a merge to merge as much as is possible while not violating the above.

as for now i removed the guard around OverrideableByLikeKind registration. it parsing is now shared while gen keeps its original module inheritance whenever CRC or save compatibility is enabled, also it adopts the Zero Hour inheritance rules when both flags are disabled

ready for re review

@OmarAglan
OmarAglan force-pushed the unify/thingtemplate-editor-accessors branch from f3a482f to 9483c40 Compare September 21, 2026 15:06
OmarAglan added a commit to OmarAglan/GeneralsGameCode that referenced this pull request Sep 21, 2026
OmarAglan added a commit to OmarAglan/GeneralsGameCode that referenced this pull request Sep 21, 2026

@xezon xezon 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.

Is not looking convincing.

Comment thread Generals/Code/GameEngine/Include/Common/ThingTemplate.h Outdated
Comment thread Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp Outdated
Comment thread Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp Outdated
Comment thread GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp Outdated
Comment thread Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp Outdated
Comment thread GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp Outdated
Comment thread Core/GameEngine/Source/Common/Thing/ThingTemplate.cpp
Comment thread Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp
@xezon xezon added the Unify Unifies code between Generals and Zero Hour label Sep 24, 2026
@OmarAglan

Copy link
Copy Markdown
Author

Is not looking convincing.

I assume you are right, will improve it based on the feedback.

OmarAglan added a commit to OmarAglan/GeneralsGameCode that referenced this pull request Sep 24, 2026
OmarAglan added a commit to OmarAglan/GeneralsGameCode that referenced this pull request Sep 24, 2026
@OmarAglan
OmarAglan force-pushed the unify/thingtemplate-editor-accessors branch from 9483c40 to df0fbfd Compare September 24, 2026 14:45
Comment thread Core/GameEngine/Source/Common/Thing/ThingTemplate.cpp Outdated
OmarAglan added a commit to OmarAglan/GeneralsGameCode that referenced this pull request Sep 24, 2026
OmarAglan added a commit to OmarAglan/GeneralsGameCode that referenced this pull request Sep 24, 2026
@OmarAglan
OmarAglan force-pushed the unify/thingtemplate-editor-accessors branch from df0fbfd to e9a0463 Compare September 24, 2026 15:53

@xezon xezon 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.

Logically looks very good now. I did not see mistake.

@Caball009 @Skyaero42 Can one of you run this against a number of Generals Replays?

Comment thread Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp Outdated
Comment thread Core/GameEngine/Source/Common/Thing/ThingTemplate.cpp
@xezon xezon added Gen Relates to Generals ZH Relates to Zero Hour labels Sep 25, 2026
@xezon xezon added this to the Code foundation build up milestone Sep 25, 2026
@Skyaero42

Copy link
Copy Markdown

Logically looks very good now. I did not see mistake.

@Caball009 @Skyaero42 Can one of you run this against a number of Generals Replays?

Will do

OmarAglan added a commit to OmarAglan/GeneralsGameCode that referenced this pull request Sep 25, 2026
OmarAglan added a commit to OmarAglan/GeneralsGameCode that referenced this pull request Sep 25, 2026
@OmarAglan
OmarAglan force-pushed the unify/thingtemplate-editor-accessors branch from e9a0463 to 3e4bf9b Compare September 25, 2026 12:22

@Skyaero42 Skyaero42 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.

Went through about 100 replays, no issues found.

@xezon

xezon commented Sep 26, 2026 •

Copy link
Copy Markdown

Rename the first commit to unify(thingtemplate): Merge ThingTemplate (#3324). Is simpler and more consistent with historic commits.

@OmarAglan
OmarAglan force-pushed the unify/thingtemplate-editor-accessors branch from 3e4bf9b to 620adbd Compare September 26, 2026 08:10
@OmarAglan

Copy link
Copy Markdown
Author

Rename the first commit to unify(thingtemplate): Merge ThingTemplate (#3324). Is simpler and more consistent with historic commits.

Done, it now renamed

@xezon

xezon commented Sep 26, 2026

Copy link
Copy Markdown

Thank you.

@xezon
xezon merged commit d6837ff into TheSuperHackers:main Sep 26, 2026
24 checks passed
@OmarAglan
OmarAglan deleted the unify/thingtemplate-editor-accessors branch September 26, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gen Relates to Generals 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.

3 participants