Hopefully fixed the long distance targeting bug for good this time. The primary target's distance from player is now checked on a per-frame basis and the target is released if the distance is higher than maximum scanner range.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@4558 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
7356224196
commit
1e566c3eea
@ -2068,6 +2068,14 @@ static bool minShieldLevelPercentageInitialised = false;
|
||||
}
|
||||
[hud setScannerZoom:z1];
|
||||
}
|
||||
|
||||
// scanner sanity check - lose any targets further than maximum scanner range
|
||||
ShipEntity *primeTarget = [UNIVERSE entityForUniversalID:primaryTarget];
|
||||
if (primeTarget && distance2([primeTarget position], [self position]) > SCANNER_MAX_RANGE2 && !autopilot_engaged)
|
||||
{
|
||||
[UNIVERSE addMessage:DESC(@"target-lost") forCount:3.0];
|
||||
[self removeTarget:primeTarget];
|
||||
}
|
||||
|
||||
// update subentities
|
||||
UPDATE_STAGE(@"updating subentities");
|
||||
|
@ -150,12 +150,6 @@ MA 02110-1301, USA.
|
||||
if (target != nil)
|
||||
{
|
||||
[me addTarget:target];
|
||||
// Out of player's scanner range? Lose target - Nikos 20110415
|
||||
if ([me isPlayer] && distance2([me position], [target position]) > SCANNER_MAX_RANGE2)
|
||||
{
|
||||
[UNIVERSE addMessage:DESC(@"target-lost") forCount:3.0];
|
||||
[me removeTarget:target];
|
||||
}
|
||||
}
|
||||
else [me removeTarget:[me primaryTarget]];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user