bugfix(aiupdate): Let Tunnel Network passengers exit from any tunnel - #3136
bugfix(aiupdate): Let Tunnel Network passengers exit from any tunnel#3136Okladnoj wants to merge 1 commit into
Conversation
PR Summary by QodoFix Tunnel Network evacuation by validating containment via shared contents list
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1. O(n²) tunnel evacuate
|
3f4abcc to
6e75c21
Compare
…t check Addresses review findings on TheSuperHackers#3136: skip the list scan when the addressed object already is our container, and fall back to the previous identity check when the container exposes no contents list.
…t check Addresses review findings on TheSuperHackers#3136: skip the list scan when the addressed object already is our container, and fall back to the previous identity check when the container exposes no contents list.
6e75c21 to
6ce04ca
Compare
Follows Caball009's suggestion on TheSuperHackers#3136. Behaviour is unchanged.
Follows Caball009's suggestion on TheSuperHackers#3136. Behaviour is unchanged.
bobtista
left a comment
There was a problem hiding this comment.
LGTM
The only nit I can see is some if () returns without braces, which is just formatting preference.
6ce04ca to
06eece5
Compare
…t check Addresses review notes from xezon on TheSuperHackers#3136: - restore the original @BugFix date, the fix itself is unchanged - drop the double null test in favour of an early return - explain why a Tunnel Network needs the contain list check Behaviour is unchanged.
…t check Addresses review notes from xezon on TheSuperHackers#3136: - restore the original @BugFix date, the fix itself is unchanged - drop the double null test in favour of an early return - explain why a Tunnel Network needs the contain list check Behaviour is unchanged.
|
@xezon On There is no extra iteration anyway: the outer On unbinding the container pointer earlier. That changes game logic and would show up in the CRC, so better as a separate PR. |
|
Can we perhaps add |
Probably will —
if (!contain->isTunnelContain())
continue;
const TunnelContain* tunnelContain = static_cast<const TunnelContain*>(contain);Caves do reach that loop — they register through Second one is |
|
Ok. How about we add a new virtual function to contain modules |
Follows xezon's suggestion on TheSuperHackers#3136: a dedicated predicate tells whether a container shares its contents list with the rest of its network, so the exit check only inspects the list when it can matter. TRUE for TunnelContain and CaveContain, FALSE for every other container.
06eece5 to
d445878
Compare
Done. Ran a ~95,700 frame replay, all good. |
Implementation change since review
Follow-up to TheSuperHackers#3089. The exit command is rejected unless the addressed object is the passenger's own container, but a GLA Tunnel Network shares one contents list across every tunnel, so only the tunnel a unit entered would release it. Ask the addressed container whether it holds the unit instead.
d445878 to
a5d5fe6
Compare
Follows xezon's suggestion on TheSuperHackers#3136: a dedicated predicate tells whether a container shares its contents list with the rest of its network, so the exit check only inspects the list when it can matter. TRUE for TunnelContain and CaveContain, FALSE for every other container.
Follow-up to #3089 — problem: evacuating a Tunnel Network does not work (build two
tunnels, load units through the first one, press Evacuate on the second one — nobody
comes out).
A Tunnel Network keeps a single contents list shared by every tunnel, while a
passenger's
getContainedBy()points at the tunnel it entered, so #3089 rejectseveryone addressed to a different tunnel. Now we ask the addressed container whether it
holds the unit, instead of comparing container objects.