bugfix: Restore retail compatibility after retail behavior flags change#2727
bugfix: Restore retail compatibility after retail behavior flags change#2727Caball009 wants to merge 3 commits into
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Include/Common/GameDefines.h | Central change: introduces PRESERVE_RETAIL_BEHAVIOR and reorders macro definitions; the sentinel's condition always evaluates true when the macro is not pre-defined, so setting RETAIL_COMPATIBLE_CRC=0 does not propagate to the dependent PRESERVE_* flags as intended (already flagged in a prior review thread). |
| GeneralsMD/Code/GameEngine/Include/Common/TunnelTracker.h | Reorders RETAIL_COMPATIBLE_CRC before PRESERVE_TUNNEL_HEAL_STACKING in the #if guard for healObjects; logically equivalent, style-consistent change. |
| GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp | Refactors !A && !B to !(A |
| GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp | Reorders operands in two tunnel-heal #if guards to match the new canonical order; no functional change. |
| GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp | Rewrites !RETAIL_COMPATIBLE_CRC && !PRESERVE_NO_XP_FROM_POISON_KILLS as !(RETAIL_COMPATIBLE_CRC |
| GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp | Reorders RETAIL_COMPATIBLE_CRC before PRESERVE_TUNNEL_HEAL_STACKING in the update() guard; equivalent change for consistency. |
| GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp | Rewrites !RETAIL_COMPATIBLE_CRC && !PRESERVE_NO_XP_FROM_OCL_KILLS to !(RETAIL_COMPATIBLE_CRC |
Reviews (2): Last reviewed commit: "Changed macro expressions." | Re-trigger Greptile
| #if RETAIL_COMPATIBLE_CRC || !defined(PRESERVE_RETAIL_BEHAVIOR) | ||
| #define PRESERVE_RETAIL_BEHAVIOR (1) // Retain specific behavior present in retail Generals 1.08 and Zero Hour 1.04. Should only be used in this file. | ||
| #endif |
There was a problem hiding this comment.
The
PRESERVE_RETAIL_BEHAVIOR condition is always true at this point in the file, making RETAIL_COMPATIBLE_CRC have no practical effect. When RETAIL_COMPATIBLE_CRC is 0, the expression evaluates to 0 || !defined(PRESERVE_RETAIL_BEHAVIOR). Since PRESERVE_RETAIL_BEHAVIOR has not been defined yet at this location, !defined(PRESERVE_RETAIL_BEHAVIOR) is unconditionally true, so the macro is set to 1 regardless of the CRC flag. A developer setting RETAIL_COMPATIBLE_CRC=0 to test bug-fixed code will find that all PRESERVE_RETAIL_BEHAVIOR-gated paths (building resumption delay, multi-crate pickup, flame-kill XP, structure stealth, unreliable firestorms, money-per-minute) remain active.
| #if RETAIL_COMPATIBLE_CRC || !defined(PRESERVE_RETAIL_BEHAVIOR) | |
| #define PRESERVE_RETAIL_BEHAVIOR (1) // Retain specific behavior present in retail Generals 1.08 and Zero Hour 1.04. Should only be used in this file. | |
| #endif | |
| #ifndef PRESERVE_RETAIL_BEHAVIOR | |
| #define PRESERVE_RETAIL_BEHAVIOR RETAIL_COMPATIBLE_CRC // Retain specific behavior present in retail Generals 1.08 and Zero Hour 1.04. Should only be used in this file. | |
| #endif |
Prompt To Fix With AI
This is a comment left during a code review.
Path: Core/GameEngine/Include/Common/GameDefines.h
Line: 34-36
Comment:
The `PRESERVE_RETAIL_BEHAVIOR` condition is always true at this point in the file, making `RETAIL_COMPATIBLE_CRC` have no practical effect. When `RETAIL_COMPATIBLE_CRC` is 0, the expression evaluates to `0 || !defined(PRESERVE_RETAIL_BEHAVIOR)`. Since `PRESERVE_RETAIL_BEHAVIOR` has not been defined yet at this location, `!defined(PRESERVE_RETAIL_BEHAVIOR)` is unconditionally true, so the macro is set to 1 regardless of the CRC flag. A developer setting `RETAIL_COMPATIBLE_CRC=0` to test bug-fixed code will find that all `PRESERVE_RETAIL_BEHAVIOR`-gated paths (building resumption delay, multi-crate pickup, flame-kill XP, structure stealth, unreliable firestorms, money-per-minute) remain active.
```suggestion
#ifndef PRESERVE_RETAIL_BEHAVIOR
#define PRESERVE_RETAIL_BEHAVIOR RETAIL_COMPATIBLE_CRC // Retain specific behavior present in retail Generals 1.08 and Zero Hour 1.04. Should only be used in this file.
#endif
```
How can I resolve this? If you propose a fix, please make it concise.
Mauller
left a comment
There was a problem hiding this comment.
If we do add the overall preserve retail flag pattern, it might be better to split out the custom configuration into a cmake file for the pre configured flags that we are setting.
| #define RETAIL_COMPATIBLE_XFER_SAVE (1) // Game is expected to be Xfer Save compatible with retail Generals 1.08, Zero Hour 1.04 | ||
| #endif | ||
|
|
||
| #if RETAIL_COMPATIBLE_CRC || !defined(PRESERVE_RETAIL_BEHAVIOR) |
There was a problem hiding this comment.
I don't think re-adding the PRESEVE_RETAIL_BEHAVIOR flag is really necessary.
We only need to fix the site of use.
There was a problem hiding this comment.
Yes. Just add RETAIL_COMPATIBLE_CRC next to PRESERVE_STRUCTURE_STEALTH_DURING_REPAIR and PRESERVE_MULTI_CRATE_PICKUP and this will be it.
|
|
||
| #ifndef PRESERVE_BUILDING_RESUMPTION_DELAY | ||
| #define PRESERVE_BUILDING_RESUMPTION_DELAY (0) // The fix for this unfavorable behavior was approved by the Game Design Committee. | ||
| #define PRESERVE_BUILDING_RESUMPTION_DELAY PRESERVE_RETAIL_BEHAVIOR // The fix for this unfavorable behavior was approved by the Game Design Committee. |
There was a problem hiding this comment.
The problem here is that you have re-enabled the retail behaviour being used when retail compatibler CRC is disabled.
#2691 Turned off some retail behavior which introduces mismatches. This PR aims to fix that.
TODO: