Skip to content

unify(common): Move DamageFX, Dict, DiscreteCircle, Language, MessageStream... to Core - #3038

Merged
xezon merged 1 commit into
TheSuperHackers:mainfrom
Jaredl-Dev:unify/identical-common
Aug 1, 2026
Merged

unify(common): Move DamageFX, Dict, DiscreteCircle, Language, MessageStream... to Core#3038
xezon merged 1 commit into
TheSuperHackers:mainfrom
Jaredl-Dev:unify/identical-common

Conversation

@Jaredl-Dev

@Jaredl-Dev Jaredl-Dev commented Aug 1, 2026

Copy link
Copy Markdown

This moves nine Common header/source pairs shared by Generals and Zero Hour into Core:

  • DamageFX
  • Dict
  • DiscreteCircle
  • Language
  • MessageStream
  • MiniLog
  • PerfTimer
  • TerrainTypes
  • version

The files are code-identical between both games. Seventeen files differ only in the product-name banner inside the opening license comment.

Verification

  • Verified identical complete normalized source for all 18 files
  • cmake --workflow --preset vc6
  • cmake --workflow --preset win32

@greptile-apps

greptile-apps Bot commented Aug 1, 2026

Copy link
Copy Markdown

Greptile Summary

The PR consolidates nine code-identical Common header/source pairs into Core so Generals and Zero Hour compile one shared source set.

  • Enables all nine pairs in the Core GameEngine source list.
  • Removes the duplicate pairs from both product-specific GameEngine source lists and trees.
  • Records the completed moves in scripts/cpp/unify_move_files.py.
  • Preserves compilation under each product target through the existing Core INTERFACE source target.

Confidence Score: 5/5

The PR appears safe to merge with no concrete build, runtime, or compatibility defects identified.

The moved implementations remain compiled once per product with the appropriate target definitions, their headers remain transitively available, and comparison of the former copies found no semantic divergence.

Important Files Changed

Filename Overview
Core/GameEngine/CMakeLists.txt Enables the nine shared header/source pairs on the Core INTERFACE source target consumed by both game libraries.
Generals/Code/GameEngine/CMakeLists.txt Removes the duplicate Generals compilation entries while retaining the shared Core target dependency.
GeneralsMD/Code/GameEngine/CMakeLists.txt Removes the duplicate Zero Hour compilation entries while retaining the shared Core target dependency.
scripts/cpp/unify_move_files.py Adds commented records of the eighteen completed file moves without changing script execution.
Core/GameEngine/Source/Common/MessageStream.cpp Moves the shared implementation into Core and removes one behavior-neutral trailing space.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Shared["Core GameEngine<br/>nine shared Common pairs"]
  G["g_gameengine<br/>RTS_GENERALS"]
  Z["z_gameengine<br/>RTS_ZEROHOUR"]
  GE["Generals executable and tools"]
  ZE["Zero Hour executable and tools"]
  Shared -->|INTERFACE sources| G
  Shared -->|INTERFACE sources| Z
  G --> GE
  Z --> ZE
Loading

Reviews (1): Last reviewed commit: "unify(common): Move identical files to C..." | Re-trigger Greptile

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

Validated with winmerge that these files are indeed identical.

Comment thread Core/GameEngine/Source/Common/MessageStream.cpp Outdated
@xezon xezon added Gen Relates to Generals ZH Relates to Zero Hour Unify Unifies code between Generals and Zero Hour labels Aug 1, 2026
@Jaredl-Dev
Jaredl-Dev force-pushed the unify/identical-common branch from f046958 to 4da700f Compare August 1, 2026 18:40

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

Looking good

@xezon xezon changed the title unify(common): Move code-identical files to Core unify(common): Move DamageFX, Dict, DiscreteCircle, Language, MessageStream... to Core Aug 1, 2026
@xezon
xezon merged commit 8d39ede into TheSuperHackers:main Aug 1, 2026
16 checks passed
@Jaredl-Dev
Jaredl-Dev deleted the unify/identical-common branch August 1, 2026 20:17
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