Skip to content

unify(rts): Merge and move Common/RTS and SpecialPowerType to Core - #3733

Open
Jaredl-Dev wants to merge 2 commits into
TheSuperHackers:mainfrom
Jaredl-Dev:unify/common-rts
Open

Jaredl-Dev wants to merge 2 commits into
TheSuperHackers:mainfrom
Jaredl-Dev:unify/common-rts

Conversation

@Jaredl-Dev

@Jaredl-Dev Jaredl-Dev commented Nov 28, 2026 •

Copy link
Copy Markdown

Unifies all 32 Common/RTS files (15 Source/Common/RTS/*.cpp, their matching Include/Common/*.h, plus SpecialPowerType.h and SpecialPowerMaskType.h) into Core: first merging the copies and required Generals-side dependency stubs, then moving the identical files to Core as 100% renames. Zero Hour has no behavioral changes.

Retail-compatible Generals game logic, CRC, network, and save formats are preserved via guards. Player-level vision spying and Player::onStructureConstructionComplete EVA superweapon messages stay under RTS_GENERALS until Object, SpyVisionUpdate, and Eva are unified.

Verification: Full VC6 and Win32 builds pass. Retail replays pass with VC6: Generals 1.08 (6/6, 0 errors) and Zero Hour 1.04 (10/10, 0 errors).

Generals Changes (Retail Compatible)

UI (InGameUI / ControlBar)

  • ActionManager::canHijackVehicle rejects KINDOF_DRONE targets so hijackers no longer show a hijack cursor on drones.
  • ActionManager::canFireWeaponAtObject enforces canSnipeVehicle (which also rejects drones) and checks only the requested weapon slot for DAMAGE_KILLPILOT weapon commands.
  • Player::becomingLocalPlayer, attemptToPurchaseScience, addUpgrade, and removeUpgrade call TheControlBar->markUIDirty() for the local player.

Data-dependent behavior

  • SpecialPowerType, SpecialPowerMaskType::s_bitNameList, and ActionManager targeting switches now include the Zero Hour special powers for custom data/mods, in Zero Hour's enum order (the order does not reach saves, CRC, or network messages).
  • ActionManager::canEnterObject blocks KINDOF_REJECT_UNMANNED infantry from entering unmanned vehicles, and SPECIAL_DISGUISE_AS_VEHICLE rejects KINDOF_CLIFF_JUMPER targets.
  • ActionManager::getCanAttackObject falls back to getClosestRider on KINDOF_SPAWNS_ARE_THE_WEAPONS objects that have a ContainModule and no SpawnBehavior.

Generals Changes (Only with Retail Compatibility Off)

Guarded under RETAIL_COMPATIBLE_CRC to preserve retail simulation/AI/script behavior:

  • ActionManager::canGetRepairedAt rejects immobile objects (!obj->isMobile()).
  • ActionManager::getCanAttackObject rejects CMD_FROM_PLAYER attacks when no weapon slot has a non-zero AutoChooseSources command source mask.
  • ActionManager capture/hacking checks, Team::getTeamTargetObject, and TunnelTracker::getCurNemesis no longer treat disguised (OBJECT_STATUS_DISGUISED) targets as untargetable when stealthed and undetected.
  • ActionManager::canDoSpecialPowerAtLocation validates SPECIAL_SPY_SATELLITE, SPECIAL_RADAR_VAN_SCAN, and SPECIAL_SPY_DRONE coordinates with isPointOnMap.
  • Team::getTeamTargetObject ignores KINDOF_AIRCRAFT as a shared team target.
  • Player::sellEverythingUnderTheSun sells only faction structures, command centers, and power plants rather than all player objects.
  • Player::canBuild enforces canBuildMoreOfType(tmplate) limits (matching BuildAssistant::canMakeUnit).

Guarded for network/save format compatibility:

  • Player::update syncs m_logicalRetaliationModeEnabled via MSG_ENABLE_RETALIATION_MODE (RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_NETWORKING; ActiveBody in Generals does not yet read the flag).
  • Energy::xfer saves version 3 with m_powerSabotagedTillFrame (RETAIL_COMPATIBLE_XFER_SAVE, otherwise stays at version 2).

Other

  • Added Generals-only declarations/helpers needed by unified Common/RTS in CollideModule.h, CrateCollide.h, MinefieldBehavior.h, OpenContain.h, PhysicsUpdate.h, ToppleUpdate.h, ContainModule.h, SpecialPowerModule.h, Object.{h,cpp}, WeaponSet.{h,cpp}, AIPlayer.{h,cpp}, and AISkirmishPlayer.{h,cpp}.
  • Updated Core, Generals, and GeneralsMD GameEngine/CMakeLists.txt and recorded the moved files in scripts/cpp/unify_move_files.py.

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Explain Change →

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.

Walkthrough

The PR moves shared RTS headers and implementations into Core and changes build-specific compatibility behavior. It also changes Generals vision-spying state, AI targeting and building-placement APIs, gameplay module queries, and weapon-slot attack checks.

Changes

Shared RTS engine consolidation and compatibility

Layer / File(s) Summary
Move shared RTS files into Core
Core/GameEngine/CMakeLists.txt, Generals/Code/GameEngine/CMakeLists.txt, GeneralsMD/Code/GameEngine/CMakeLists.txt, Generals/Code/GameEngine/Include/Common/*, Generals/Code/GameEngine/Source/Common/RTS/*, scripts/cpp/unify_move_files.py
Core’s build list activates shared RTS headers and sources. The Generals and GeneralsMD build lists exclude selected entries. The previous Generals copies are deleted, and the move script records commented-out calls for file moves.
Retail-compatible gameplay and save rules
Core/GameEngine/Include/Common/SpecialPowerType.h, Core/GameEngine/Source/Common/RTS/ActionManager.cpp, Core/GameEngine/Source/Common/RTS/Energy.cpp, Core/GameEngine/Source/Common/RTS/Player.cpp, Core/GameEngine/Source/Common/RTS/SpecialPower.cpp, Core/GameEngine/Source/Common/RTS/Team.cpp, Core/GameEngine/Source/Common/RTS/TunnelTracker.cpp
Build conditions change action eligibility, target filtering, special-power enum ordering, energy transfer versioning, player behavior, and team and tunnel target checks.
Track and transfer player vision-spying state
Core/GameEngine/Include/Common/Player.h, Core/GameEngine/Source/Common/RTS/Player.cpp
Generals builds add per-player vision-spying reference counts and a mask. Player initialization, map initialization, updates, and transfer data handle this state.

AI targeting and building placement

Layer / File(s) Summary
Return superweapon targeting results
Generals/Code/GameEngine/Include/GameLogic/AIPlayer.h, Generals/Code/GameEngine/Include/GameLogic/AISkirmishPlayer.h, Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp, Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp
AI and skirmish-player methods return a Boolean targeting result. The cluster-mines branch returns true after selecting a target.
Search for construction locations
Generals/Code/GameEngine/Include/GameLogic/AIPlayer.h, Generals/Code/GameEngine/Include/GameLogic/Module/SpecialPowerModule.h, Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp
AIPlayer adds methods to search for legal construction locations and build near a team. SpecialPowerModuleInterface exposes the final-product template for construction sites.

Gameplay module capability queries

Layer / File(s) Summary
Add collision and containment queries
Generals/Code/GameEngine/Include/GameLogic/Module/*.h
Module interfaces add queries for sabotage-building crate collisions and rider-change containment. The listed module classes return false for the new checks.

Weapon-slot-specific attack checks

Layer / File(s) Summary
Expose weapon-slot queries
Generals/Code/GameEngine/Include/GameLogic/Object.h, Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h
Object and WeaponSet declarations add optional weapon-slot arguments for attack checks and expose a slot’s command-source mask.
Forward and apply the selected slot
Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp, Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp
Object forwards the selected slot to WeaponSet. WeaponSet checks that slot when specified and retains its all-slots behavior when no slot is specified.

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

Change: Refactor

Possibly related issues

  • TheSuperHackers/GeneralsGameCode#3646 — The PR changes retaliation-mode polling and message emission under retail-compatible build conditions in Player.cpp; the summaries do not confirm whether this fully enforces the issue’s live-match-only requirement.

Suggested reviewers: xezon, bobtista, caball009

Merge Risk: Low · up to 85c94

This PR moves shared RTS code into Core and adds Generals support for behavior that already exists in Zero Hour. Six minor edge-case issues in attack validation and AI building placement are noted, and none blocks the merge. Author-reported replay checks pass, so merge risk is low.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the Common/RTS files and SpecialPowerType are merged and moved from GeneralsMD to Core under the unify effort. It is short, specific, and matches the changeset. The ti…
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.
Description check Passed The description is specific and related to the changeset. It states that 32 Common/RTS files are unified into Core as renames. It lists the Generals behavior changes under RETAIL_COMPATIBLE_CRC and ne…
Full details: Title check

Explanation

The title names the main change: the Common/RTS files and SpecialPowerType are merged and moved from GeneralsMD to Core under the unify effort. It is short, specific, and matches the changeset. The title does not mention the Generals-side guarded behavior changes, which is acceptable because the title need not cover every detail.

Full details: Description check

Explanation

The description is specific and related to the changeset. It states that 32 Common/RTS files are unified into Core as renames. It lists the Generals behavior changes under RETAIL_COMPATIBLE_CRC and network/save guards. It also names the CMakeLists.txt updates, the unify_move_files.py script, and the verification builds and replays. It describes the changes in the raw summary, so the description is not off-topic or generic.

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cb3f8728-62a2-49a8-8aa4-abbf26b77d7e
Commits

Reviewing files that changed from the base of the PR and between 9bc8cc9 and 85c945a.

Files selected for processing: 30

  • Core/GameEngine/Include/Common/ActionManager.h
  • Core/GameEngine/Include/Common/Energy.h
  • Core/GameEngine/Include/Common/Handicap.h
  • Core/GameEngine/Include/Common/MissionStats.h
  • Core/GameEngine/Include/Common/Money.h
  • Core/GameEngine/Include/Common/PlayerList.h
  • Core/GameEngine/Include/Common/PlayerTemplate.h
  • Core/GameEngine/Include/Common/ProductionPrerequisite.h
  • Core/GameEngine/Include/Common/ResourceGatheringManager.h
  • Core/GameEngine/Include/Common/Science.h
  • Core/GameEngine/Include/Common/ScoreKeeper.h
  • Core/GameEngine/Include/Common/SpecialPower.h
  • Core/GameEngine/Include/Common/SpecialPowerMaskType.h
  • Core/GameEngine/Include/Common/SpecialPowerType.h
  • Core/GameEngine/Include/Common/Team.h
  • Core/GameEngine/Include/Common/TunnelTracker.h
  • Core/GameEngine/Source/Common/RTS/ActionManager.cpp
  • Core/GameEngine/Source/Common/RTS/Handicap.cpp
  • Core/GameEngine/Source/Common/RTS/MissionStats.cpp
  • Core/GameEngine/Source/Common/RTS/Money.cpp
  • Core/GameEngine/Source/Common/RTS/Player.cpp
  • Core/GameEngine/Source/Common/RTS/PlayerList.cpp
  • Core/GameEngine/Source/Common/RTS/PlayerTemplate.cpp
  • Core/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp
  • Core/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp
  • Core/GameEngine/Source/Common/RTS/Science.cpp
  • Core/GameEngine/Source/Common/RTS/ScoreKeeper.cpp
  • Core/GameEngine/Source/Common/RTS/SpecialPower.cpp
  • Core/GameEngine/Source/Common/RTS/Team.cpp
  • Core/GameEngine/Source/Common/RTS/TunnelTracker.cpp
Files with no reviewable changes: 24

  • Core/GameEngine/Include/Common/ActionManager.h
  • Core/GameEngine/Include/Common/Energy.h
  • Core/GameEngine/Include/Common/Handicap.h
  • Core/GameEngine/Include/Common/MissionStats.h
  • Core/GameEngine/Include/Common/Money.h
  • Core/GameEngine/Include/Common/PlayerList.h
  • Core/GameEngine/Include/Common/PlayerTemplate.h
  • Core/GameEngine/Include/Common/ProductionPrerequisite.h
  • Core/GameEngine/Include/Common/ResourceGatheringManager.h
  • Core/GameEngine/Include/Common/Science.h
  • Core/GameEngine/Include/Common/ScoreKeeper.h
  • Core/GameEngine/Include/Common/SpecialPower.h
  • Core/GameEngine/Include/Common/SpecialPowerMaskType.h
  • Core/GameEngine/Include/Common/Team.h
  • Core/GameEngine/Include/Common/TunnelTracker.h
  • Core/GameEngine/Source/Common/RTS/Handicap.cpp
  • Core/GameEngine/Source/Common/RTS/MissionStats.cpp
  • Core/GameEngine/Source/Common/RTS/Money.cpp
  • Core/GameEngine/Source/Common/RTS/PlayerList.cpp
  • Core/GameEngine/Source/Common/RTS/PlayerTemplate.cpp
  • Core/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp
  • Core/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp
  • Core/GameEngine/Source/Common/RTS/Science.cpp
  • Core/GameEngine/Source/Common/RTS/ScoreKeeper.cpp

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

@greptile-apps

greptile-apps Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge; no new actionable defect was established.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable defect was established.

Summary

Moves the shared RTS files into Core and updates both games to use them.

  • Both games build shared RTS code from Core.
  • Generals checks weapon commands and vehicle targets more closely.
  • Generals refreshes local controls and applies narrower player rules.
  • Generals keeps retail network, save, and simulation paths guarded.
  • Generals keeps player-level vision spying separate from unit-level spying.
  • Shared special-power checks recognize Zero Hour powers without shifting saved values.
  • Generals AI can find legal construction spots near teams.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Shared["Core: shared RTS sources and headers"] --> Generals["Generals engine"]
  Shared --> ZeroHour["Zero Hour engine"]
  Guards["Variant and retail-compatibility flags"] --> Generals
  Guards --> ZeroHour
Loading

Reviews (4) · Last reviewed commit: "unify(rts): Move Common/RTS files to Cor..." · Reviewed by Greptile

@Jaredl-Dev Jaredl-Dev changed the title unify(rts): Unify Common/RTS and SpecialPowerType in Core unify(rts): Merge and move Common/RTS and SpecialPowerType to Core Nov 28, 2026
Jaredl-Dev added a commit to Jaredl-Dev/GeneralsGameCode that referenced this pull request Nov 28, 2026
Jaredl-Dev added a commit to Jaredl-Dev/GeneralsGameCode that referenced this pull request Nov 28, 2026

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

Actionable comments posted: 6

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0cf35166-9e11-4260-84dd-ccc0a30255b3
Commits

Reviewing files that changed from the base of the PR and between 9afbe5c and e79d278.

Files selected for processing: 84

  • Core/GameEngine/CMakeLists.txt
  • Core/GameEngine/Include/Common/ActionManager.h
  • Core/GameEngine/Include/Common/Energy.h
  • Core/GameEngine/Include/Common/Handicap.h
  • Core/GameEngine/Include/Common/MissionStats.h
  • Core/GameEngine/Include/Common/Money.h
  • Core/GameEngine/Include/Common/Player.h
  • Core/GameEngine/Include/Common/PlayerList.h
  • Core/GameEngine/Include/Common/PlayerTemplate.h
  • Core/GameEngine/Include/Common/ProductionPrerequisite.h
  • Core/GameEngine/Include/Common/ResourceGatheringManager.h
  • Core/GameEngine/Include/Common/Science.h
  • Core/GameEngine/Include/Common/ScoreKeeper.h
  • Core/GameEngine/Include/Common/SpecialPower.h
  • Core/GameEngine/Include/Common/SpecialPowerMaskType.h
  • Core/GameEngine/Include/Common/SpecialPowerType.h
  • Core/GameEngine/Include/Common/Team.h
  • Core/GameEngine/Include/Common/TunnelTracker.h
  • Core/GameEngine/Source/Common/RTS/ActionManager.cpp
  • Core/GameEngine/Source/Common/RTS/Energy.cpp
  • Core/GameEngine/Source/Common/RTS/Handicap.cpp
  • Core/GameEngine/Source/Common/RTS/MissionStats.cpp
  • Core/GameEngine/Source/Common/RTS/Money.cpp
  • Core/GameEngine/Source/Common/RTS/Player.cpp
  • Core/GameEngine/Source/Common/RTS/PlayerList.cpp
  • Core/GameEngine/Source/Common/RTS/PlayerTemplate.cpp
  • Core/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp
  • Core/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp
  • Core/GameEngine/Source/Common/RTS/Science.cpp
  • Core/GameEngine/Source/Common/RTS/ScoreKeeper.cpp
  • Core/GameEngine/Source/Common/RTS/SpecialPower.cpp
  • Core/GameEngine/Source/Common/RTS/Team.cpp
  • Core/GameEngine/Source/Common/RTS/TunnelTracker.cpp
  • Generals/Code/GameEngine/CMakeLists.txt
  • Generals/Code/GameEngine/Include/Common/ActionManager.h
  • Generals/Code/GameEngine/Include/Common/Energy.h
  • Generals/Code/GameEngine/Include/Common/Handicap.h
  • Generals/Code/GameEngine/Include/Common/MissionStats.h
  • Generals/Code/GameEngine/Include/Common/Money.h
  • Generals/Code/GameEngine/Include/Common/Player.h
  • Generals/Code/GameEngine/Include/Common/PlayerList.h
  • Generals/Code/GameEngine/Include/Common/PlayerTemplate.h
  • Generals/Code/GameEngine/Include/Common/ProductionPrerequisite.h
  • Generals/Code/GameEngine/Include/Common/ResourceGatheringManager.h
  • Generals/Code/GameEngine/Include/Common/Science.h
  • Generals/Code/GameEngine/Include/Common/ScoreKeeper.h
  • Generals/Code/GameEngine/Include/Common/SpecialPower.h
  • Generals/Code/GameEngine/Include/Common/SpecialPowerMaskType.h
  • Generals/Code/GameEngine/Include/Common/SpecialPowerType.h
  • Generals/Code/GameEngine/Include/Common/Team.h
  • Generals/Code/GameEngine/Include/Common/TunnelTracker.h
  • Generals/Code/GameEngine/Include/GameLogic/AIPlayer.h
  • Generals/Code/GameEngine/Include/GameLogic/AISkirmishPlayer.h
  • Generals/Code/GameEngine/Include/GameLogic/Module/CollideModule.h
  • Generals/Code/GameEngine/Include/GameLogic/Module/ContainModule.h
  • Generals/Code/GameEngine/Include/GameLogic/Module/CrateCollide.h
  • Generals/Code/GameEngine/Include/GameLogic/Module/MinefieldBehavior.h
  • Generals/Code/GameEngine/Include/GameLogic/Module/OpenContain.h
  • Generals/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h
  • Generals/Code/GameEngine/Include/GameLogic/Module/SpecialPowerModule.h
  • Generals/Code/GameEngine/Include/GameLogic/Module/ToppleUpdate.h
  • Generals/Code/GameEngine/Include/GameLogic/Object.h
  • Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h
  • Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/Energy.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/Handicap.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/MissionStats.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/Money.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/Player.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/Science.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/Team.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp
  • Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp
  • Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp
  • Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp
  • Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp
  • GeneralsMD/Code/GameEngine/CMakeLists.txt
  • scripts/cpp/unify_move_files.py
Files with no reviewable changes: 32

  • Generals/Code/GameEngine/Include/Common/ActionManager.h
  • Generals/Code/GameEngine/Include/Common/Energy.h
  • Generals/Code/GameEngine/Include/Common/Handicap.h
  • Generals/Code/GameEngine/Include/Common/MissionStats.h
  • Generals/Code/GameEngine/Include/Common/Money.h
  • Generals/Code/GameEngine/Include/Common/Player.h
  • Generals/Code/GameEngine/Include/Common/PlayerList.h
  • Generals/Code/GameEngine/Include/Common/PlayerTemplate.h
  • Generals/Code/GameEngine/Include/Common/ProductionPrerequisite.h
  • Generals/Code/GameEngine/Include/Common/ResourceGatheringManager.h
  • Generals/Code/GameEngine/Include/Common/Science.h
  • Generals/Code/GameEngine/Include/Common/ScoreKeeper.h
  • Generals/Code/GameEngine/Include/Common/SpecialPower.h
  • Generals/Code/GameEngine/Include/Common/SpecialPowerMaskType.h
  • Generals/Code/GameEngine/Include/Common/SpecialPowerType.h
  • Generals/Code/GameEngine/Include/Common/Team.h
  • Generals/Code/GameEngine/Include/Common/TunnelTracker.h
  • Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/Energy.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/Handicap.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/MissionStats.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/Money.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/Player.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/Science.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/Team.cpp
  • Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp

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


// TheSuperHackers @info Added in Zero Hour:
#if RTS_GENERALS && (RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_NETWORKING)
SPECIAL_HELIX_NAPALM_BOMB,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why does RETAIL_COMPATIBLE_NETWORKING take part in the enum position gate? I can see why CRC matters, but I could not find a network payload that carries a SpecialPowerType value.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes this looks suspicious. I suggest ask Claude why it picked it. If its reason is bogus, remove.

Then improve comment at

// Disable non retail fixes in the networking, such as putting more data per UDP packet
#ifndef RETAIL_COMPATIBLE_NETWORKING
#define RETAIL_COMPATIBLE_NETWORKING (1)
#endif

And explain the RETAIL_COMPATIBLE_* macros a bit better in the SKILL.md

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I removed the guard; both games now use the Zero Hour order and the retail replays still pass.

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

Checked the move commit against the merge commit. The 32 files are pure renames, and the Generals and Zero Hour copies were identical apart from the license header. Zero Hour only gains RTS_GENERALS gates. The Generals behavior changes are either UI-only or gated. Looks good to me.

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

Not an exhuasive review. Perhaps the claude skill can be finetuned a bit still, but i'm also not sure about all my comments.

Comment on lines +565 to +572
#if RTS_GENERALS
void setUnitsVisionSpied( Bool setting, PlayerIndex byWhom );

/// This will be asked by units when they look to get extra people to sight for
PlayerMaskType getVisionSpiedMask() const;
#else
void setUnitsVisionSpied( Bool setting, KindOfMaskType whichUnits, PlayerIndex byWhom );
#endif

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could we avoid having two different versions of setUnitsVisionSpied? For example, the Generals version just not using KindOfMaskType whichUnits?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is temporary until Object and SpyVisionUpdate are unified: Generals' SpyVisionUpdate still spies at player level.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In that case, could we merge things in different order to avoid adding temporary code in Core?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I agree, It probably would be better to have a prerequisite PR that aligns the spyvisionupdate, then have this PR do the merge and unify.

Comment on lines +322 to +324
#if RTS_GENERALS
m_visionSpiedMask = PLAYERMASK_NONE;
#endif

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

perhaps we can leave m_visionSpiedMask compiled in? reduce the ifdef spam? unless it then becomes a vc6 crc issue

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is temporary until Object and SpyVisionUpdate are unified: Generals saves still contain this field, so Player::xfer needs it.

Comment on lines +4057 to +4087
#else
// ------------------------------------------------------------------------------------------------
// Little wrapper function so I can use it in iterateObjects, which is cool.
struct VisionSpiedStruct
{
Bool setting;
KindOfMaskType whichUnits;
PlayerIndex byWhom;
};

static void iterator_setUnitsVisionSpied( Object *obj, void * voidData)
{
VisionSpiedStruct *data = (VisionSpiedStruct *)voidData;

// I feel I have to disapprove of the naming of this gathering of cell functions. It is called by death,
// alliance change, containment, spy change, and dynamic view range as well as partition cell change.
if( obj && obj->isAnyKindOf(data->whichUnits) )
obj->setVisionSpied(data->setting, data->byWhom);
}

// ------------------------------------------------------------------------------------------------
void Player::setUnitsVisionSpied( Bool setting, KindOfMaskType whichUnits, PlayerIndex byWhom )
{
VisionSpiedStruct data;
data.setting = setting;
data.whichUnits = whichUnits;
data.byWhom = byWhom;
// Being spied is now a property of the unit, not us, since we can spy only a portion of the enemy.
iterateObjects( iterator_setUnitsVisionSpied, &data );
}
#endif

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

can this ifdef go and leave it compiled in?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is temporary until Object and SpyVisionUpdate are unified: the Zero Hour version calls Object::setVisionSpied, which Generals' Object doesn't have yet.

// don't forget to add new strings to SpecialPowerMaskType::s_bitNameList[]
SPECIAL_LAUNCH_BAIKONUR_ROCKET,

// TheSuperHackers @info Added in Zero Hour:

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 comment also looks misplaced. Better placed behind the enum values.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done.


// TheSuperHackers @info Added in Zero Hour:
#if RTS_GENERALS && (RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_NETWORKING)
SPECIAL_HELIX_NAPALM_BOMB,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes this looks suspicious. I suggest ask Claude why it picked it. If its reason is bogus, remove.

Then improve comment at

// Disable non retail fixes in the networking, such as putting more data per UDP packet
#ifndef RETAIL_COMPATIBLE_NETWORKING
#define RETAIL_COMPATIBLE_NETWORKING (1)
#endif

And explain the RETAIL_COMPATIBLE_* macros a bit better in the SKILL.md

Jaredl-Dev added a commit to Jaredl-Dev/GeneralsGameCode that referenced this pull request Nov 28, 2026
Jaredl-Dev added a commit to Jaredl-Dev/GeneralsGameCode that referenced this pull request Nov 28, 2026
@Jaredl-Dev

Copy link
Copy Markdown
Author

Updated: removed the SpecialPowerType order guards, narrowed the six DISGUISED guards, and removed the helper guards. VC6/Win32 builds pass; retail replays pass (Generals 6/6, Zero Hour 10/10).

@Jaredl-Dev

Copy link
Copy Markdown
Author

@xezon Do you want the RETAIL_COMPATIBLE_NETWORKING comment update as a third commit in this PR, or in a follow-up PR?

Based on the review feedback here, I've also updated the skill guidance, which should hopefully improve future unify PRs.

@Caball009

Copy link
Copy Markdown

I'd like to have these changes checked against a couple of thousand replays (GEN and ZH) before it gets merged.

@Skyaero42 is that something you can do? If not, I can do it myself. Probably best to wait a bit until reviewers update their reviews.

@Skyaero42

Copy link
Copy Markdown

I'd like to have these changes checked against a couple of thousand replays (GEN and ZH) before it gets merged.

@Skyaero42 is that something you can do? If not, I can do it myself. Probably best to wait a bit until reviewers update their reviews.

Agree and can do after all review comments have been addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants