More docking computer fixes. Hopefully fixed the bug where stations were sometimes being targeted at huge distances.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2200 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Nikos Barkas 2009-06-10 16:48:12 +00:00
parent f5e9eaa1c4
commit 808e3c79a8
2 changed files with 8 additions and 2 deletions

View File

@ -838,7 +838,7 @@ static NSTimeInterval time_last_frame;
if (isOkayToUseAutopilot)
{
primaryTarget = NO_TARGET;
[self setTargetToSystemStation];
targetStation = [[UNIVERSE station] universalID];
autopilot_engaged = YES;
ident_engaged = NO;
[self safeAllMissiles];
@ -2775,6 +2775,7 @@ static BOOL toggling_music;
frustration = 0.0;
autopilot_engaged = NO;
primaryTarget = NO_TARGET;
targetStation = NO_TARGET;
[self setStatus:STATUS_IN_FLIGHT];
[self playAutopilotOff];
[UNIVERSE addMessage:DESC(@"autopilot-off") forCount:4.5];

View File

@ -1863,8 +1863,11 @@ static WormholeEntity *whole = nil;
StationEntity *station = nil;
Entity *targStation = nil;
NSString *message = nil;
double distanceToStation2 = 0.0;
BOOL insideMainStationAegis = NO;
targStation = [UNIVERSE entityForUniversalID:targetStation];
insideMainStationAegis = (targStation == [UNIVERSE station] && [self withinStationAegis]);
if ([targStation isStation])
{
station = (StationEntity*)targStation;
@ -1876,7 +1879,9 @@ static WormholeEntity *whole = nil;
relativeToEntity:self];
}
if (station != nil)
distanceToStation2 = distance2( [station position], [self position] );
if ((station != nil && distanceToStation2 < SCANNER_MAX_RANGE2) || insideMainStationAegis)
{
// remember the instructions
[dockingInstructions release];