[Vanilla Fix] Properly remove aircraft, jumpjet and rockets offmap when dead#2149
[Vanilla Fix] Properly remove aircraft, jumpjet and rockets offmap when dead#2149CnCRAZER wants to merge 5 commits intoPhobos-developers:developfrom
Conversation
Add documentation and credit for a bug fix where aircraft destroyed while crashing off-map were not fully cleaned up, which could permanently block production slots and count toward unit limits. Updates CREDITS.md and adds entries to Fixed-or-Improved-Logics.md and Whats-New.md (credit to RAZER).
|
Nightly build for this pull request:
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build. |
TaranDahl
left a comment
There was a problem hiding this comment.
What causes off-map or not to have different effects on crash behavior? The position you hooked doesn't seem to have such a difference.
AFAIK offmap aircraft types are only removed if they are spawned from spawner or from teamtypes exiting the map. Running uninit to clear the unit from map is also only checked if aircraft type is within radar bounds |
|
check the discord Phobos chat for the conversation regarding it |
|
I checked this. I think the location of the fix in your PR is incorrect. |
|
Oh. And there's also Rocket (662FD5). |
|
Very interesting. I'll take a look at your suggestions |
Handle units with Fly, Jumpjet or Rocket locomotors that die/crash off-map by adding locomotor-specific hooks. Replaces the previous aircraft-only approach by adding three hooks in src/Misc/Hooks.BugFixes.cpp to treat off-map as ground-touch and force the cleanup/detonation path (Fly, Jumpjet, Rocket), including a stack init for the jumpjet "fellOnSomething" flag. Also updates CREDITS.md, docs/Fixed-or-Improved-Logics.md and docs/Whats-New.md to reflect the broader scope of the fix.
Rocket and Jumpjet are now implemented at the addresses you suggested. Somebody tested the dll and sent me this link here https://drive.google.com/file/d/1MXKb1bCpaL-ZEyU6S_tM41eiYjPuFEMV/view You can see the aircraft dying offmap and being able to rebuild them now |
src/Misc/Hooks.BugFixes.cpp
Outdated
| REF_STACK(BYTE, fellOnSomething, 0x21); | ||
| fellOnSomething = 0; |
There was a problem hiding this comment.
Are you certain? Doubt if the stack offset calculation is correct. Also, why don't you use the STACK_OFFSET macro?
| // Replicate the stack init from the stolen bytes (mov byte ptr [esp+21h], 0) | ||
| // so the "fell on something" flag is properly zeroed for the crash path. | ||
| REF_STACK(BYTE, fellOnSomething, 0x21); | ||
| REF_STACK(BYTE, fellOnSomething, STACK_OFFSET(0x34, -0x13)); |
There was a problem hiding this comment.
Sure thing can try this 👍🏻

This pull request addresses a critical bug where units with Fly, Jumpjet, or Rocket locomotors that are destroyed while crashing off-map were not being properly cleaned up. This could lead to production slots being permanently blocked and unit limits being incorrectly counted. The fix ensures these units are now correctly removed from the game, and the documentation has been updated to reflect this change.
Bug fix implementation:
src/Misc/Hooks.BugFixes.cppto ensure that off-map crashing units usingFlyLocomotionClass,JumpjetLocomotionClass, andRocketLocomotionClassare treated as having touched the ground, triggering proper cleanup and resource release.Documentation updates:
docs/Fixed-or-Improved-Logics.mdto describe the fix for units with Fly, Jumpjet, or Rocket locomotors being destroyed off-map and not being cleaned up, which could block production slots and unit limits.docs/Whats-New.md, crediting the contributor.CREDITS.mdto include this bug fix in the list of individual contributions.