-
Notifications
You must be signed in to change notification settings - Fork 201
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
Fixed the problem with escorts (I think). #882
Conversation
Not tested thoroughly yet, but I think this should fix the problem of escorts causing segfaults when their origin ship dies. A cursory test shows that this seems to work. This also causes pilot.setLeader to remove "deployed" status from the origin ship.
Calling |
I've added an include for assert.h and changed player_dt_default to a function. I'm not sure about switching up the way dockpilot and dockslot are stored, it's not going to improve efficiency any (and in fact can make it worse because it adds more looping). That it involves passing pointers around is true enough but failure to clean up the other values properly can cause bugs too (just bugs that would be less obvious like choosing the wrong ship as a dockpilot and then trying to dock on a slot that it doesn't belong in). |
Now, if every single ship that could possibly have the destroyed pilot as a dockslot will always be in the escort list, that can be used to reduce looping a bit. That looks rather flimsy to me, though, and I don't think that's really worth it when the pilots have to be looped through all the time anyway. |
There we go, switched it up to use ints instead of pointers. |
Do you see my point about just removing the loop from Otherwise, the changes here look good. 👍 |
Ahhhhhhh, I see what you're saying. That does make sense come to think of it. Lemme do that... |
There we go, I've pushed that through. Seems to work. |
Not tested thoroughly yet, but I think this should fix the problem of
escorts causing segfaults when their origin ship dies. A cursory test
shows that this seems to work.
This also causes pilot.setLeader to remove "deployed" status from the
origin ship.