Makes "physics/must_lock_to_autotrack" confvar obeyed properly - now beams don't start wandering on autotracking without a target lock and then fail to collide with the target they seem to hit.
Also, if we have to read one confvar and then check it together with the same variables in 3 different places, something is already wrong.
I added bool Unit::TargetTracked and slightly improved bool Unit::TargetLocked so that either condition can be checked with one plain call (see track.cpp changes).
The player_cockpit == NULL thing is probably for NPC (to not require they lock their target, since AI needs not lock, and in fact knows not about locking).
Have you checked that NPCs can actually use autotrackers with this patch? If not, I'd try adding the player_cockpit == NULL back.
Otherwise, it looks ok. I'd apply it once that's resolved.
Right, of course.
Ok, applied with that fix (sorry for the delay, RL stuff grabbed all my free time till now)