-
Notifications
You must be signed in to change notification settings - Fork 127
fix(tunnel): Fix undefined behavior in TunnelTracker::onTunnelDestroyed and incomplete asset transfer in Team::setControllingPlayer #1958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1391,6 +1391,7 @@ Player *Team::getControllingPlayer() const | |
| // ------------------------------------------------------------------------ | ||
| void Team::setControllingPlayer(Player *newController) | ||
| { | ||
| Player* oldOwner = m_proto->getControllingPlayer(); | ||
| // NULL is not allowed, but is caught by TeamPrototype::setControllingPlayer() | ||
| m_proto->setControllingPlayer(newController); | ||
|
|
||
|
|
@@ -1399,6 +1400,7 @@ void Team::setControllingPlayer(Player *newController) | |
| // The Team doesn't change, it just starts to return a different answer when you ask for | ||
| // the controlling player. I don't want to make the major change of onCapture on everyone, | ||
| // so I will do the minor fix for the specific bug, which is harmless even when misused. | ||
| // TheSuperHackers @fix xezon 07/12/2025 Now does onCapture on everyone. | ||
|
|
||
| // Tell all members to redo their looking status, as their Player has changed, but they don't know. | ||
| for (DLINK_ITERATOR<Object> iter = iterate_TeamMemberList(); !iter.done(); iter.advance()) | ||
|
|
@@ -1407,7 +1409,14 @@ void Team::setControllingPlayer(Player *newController) | |
| if (!obj) | ||
| continue; | ||
|
|
||
| obj->handlePartitionCellMaintenance(); | ||
| if constexpr (RETAIL_COMPATIBLE_CRC) // Not sure if necessary. But likely is. | ||
| { | ||
| obj->handlePartitionCellMaintenance(); | ||
| } | ||
| else | ||
| { | ||
| obj->onCapture(oldOwner, newController); | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It worked ok in GLA 03 mission and avoids the tunnel transfer issue, but I do not know if it creates new problems. Something to keep an eye on. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They are exclusive calls depending on RETAIL_COMPATIBLE_CRC There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we test if the object is a tunnel and perform
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason I used RETAIL_COMPATIBLE_CRC is to avoid any chance of mismatch because it looks risky for any object. The crash is avoided anyway with the fix in |
||
| } | ||
| } | ||
|
|
||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth cleaning up the legacy comment as it no longer applies anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not want to nuke the EA comment so I just appended information. If you have a suggestion for how to rewrite the EA comment, please write.