bugfix(behavior): Prevent fallen Angry Mob members from respawning at the Barracks after loading a save#2314
Conversation
…fter loading a save
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp | Adds version 3 xfer serialization for m_initialBurstCountdown with RETAIL_COMPATIBLE_XFER_SAVE guard, following established codebase patterns exactly. |
| GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp | Mirror of the Generals/ change for Zero Hour - adds version 3 xfer serialization for m_initialBurstCountdown with RETAIL_COMPATIBLE_XFER_SAVE guard. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Load Save Game] --> B{Check xfer version}
B -->|version >= 2| C[Deserialize m_initialBurstTimesInited]
B -->|version < 2| D[Skip m_initialBurstTimesInited]
C --> E{version >= 3?}
D --> E
E -->|Yes - New save format| F[Deserialize m_initialBurstCountdown\nfrom save data]
E -->|No - Old save or retail| G[m_initialBurstCountdown keeps\nconstructor default value]
F --> H[Countdown reflects actual\ngame state at save time]
G --> I[Countdown resets to m_initialBurst\ne.g. 5 for Angry Mob]
H --> J[Mob members respawn\nat nexus correctly]
I --> K[Mob members respawn\nat Barracks - BUG]
Last reviewed commit: f350626
| if (version >= 3) | ||
| xfer->xferUnsignedInt(&m_initialBurstCountdown); |
There was a problem hiding this comment.
Inconsistent brace style with surrounding code (line 1007-1009 uses braces)
| if (version >= 3) | |
| xfer->xferUnsignedInt(&m_initialBurstCountdown); | |
| if (version >= 3) { | |
| xfer->xferUnsignedInt(&m_initialBurstCountdown); | |
| } |
Context Used: Rule from dashboard - Always place if/else/for/while statement bodies on separate lines from the condition to allow precis... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp
Line: 1011:1012
Comment:
Inconsistent brace style with surrounding code (line 1007-1009 uses braces)
```suggestion
if (version >= 3) {
xfer->xferUnsignedInt(&m_initialBurstCountdown);
}
```
**Context Used:** Rule from `dashboard` - Always place if/else/for/while statement bodies on separate lines from the condition to allow precis... ([source](https://app.greptile.com/review/custom-context?memory=16b9b669-b823-49be-ba5b-2bd30ff3ba6d))
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.| if (version >= 3) | ||
| xfer->xferUnsignedInt(&m_initialBurstCountdown); |
There was a problem hiding this comment.
Inconsistent brace style with surrounding code (line 1092-1094 uses braces)
| if (version >= 3) | |
| xfer->xferUnsignedInt(&m_initialBurstCountdown); | |
| if (version >= 3) { | |
| xfer->xferUnsignedInt(&m_initialBurstCountdown); | |
| } |
Context Used: Rule from dashboard - Always place if/else/for/while statement bodies on separate lines from the condition to allow precis... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp
Line: 1096:1097
Comment:
Inconsistent brace style with surrounding code (line 1092-1094 uses braces)
```suggestion
if (version >= 3) {
xfer->xferUnsignedInt(&m_initialBurstCountdown);
}
```
**Context Used:** Rule from `dashboard` - Always place if/else/for/while statement bodies on separate lines from the condition to allow precis... ([source](https://app.greptile.com/review/custom-context?memory=16b9b669-b823-49be-ba5b-2bd30ff3ba6d))
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.|
Question: Are they supposed to respawn at all? |
Yes; see |
xezon
left a comment
There was a problem hiding this comment.
Looks technically correct. Code style can be improved.
… the Barracks after loading a save (TheSuperHackers#2314)
Closes #11
This change fixes an issue where fallen Angry Mob members respawn at the Barracks after loading a save.
Angry Mob members spawn from the Barracks if
m_initialBurstCountdownis greater than 0. Asm_initialBurstCountdownis not saved in the retail game, it is always reset to its default/retail value of 5 when loading a saved game. This results in up to 5 Angry Mob members respawning from the Barracks and attempting to run across the map to join the nexus, where they often die again in the process due to being too far away.Before
Fallen Angry Mob members respawn at the Barracks
BAD_SPAWN.mp4
After
Fallen Angry Mob members respawn at the nexus
GOOD_SPAWN.mp4