Fixed submunitions fired by player not having a target and an owner. Thanks to Eric for his analysis leading to the fix. Also brought back the message 'Missiles on Safety', which seems to have disappeared as a result of a recent refactoring.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2187 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Nikos Barkas 2009-05-28 20:05:28 +00:00
parent 4fbde7c793
commit fc0cdfae2d
5 changed files with 18 additions and 6 deletions

View File

@ -3000,6 +3000,7 @@ static PlayerEntity *sSharedPlayer = nil;
[missile addTarget:target];
[missile setOrientation:q1];
[missile setStatus: STATUS_IN_FLIGHT]; // necessary to get it going!
[missile setIsMissileFlag:YES];
[missile setVelocity: vel];
[missile setSpeed:150.0];
[missile setOwner:self];

View File

@ -759,11 +759,8 @@ static NSTimeInterval time_last_frame;
[self safeAllMissiles];
if (!ident_engaged)
{
if (missile_status != MISSILE_STATUS_SAFE)
[UNIVERSE addMessage:DESC(@"missile-safe") forCount:2.0];
//[UNIVERSE addMessage:[NSString stringWithFormat:@"%@ %@", DESC(@"missile-safe"), (primaryTarget != NO_TARGET && [self hasEquipmentItem:@"EQ_SCANNER_SHOW_MISSILE_TARGET"])? DESC(@"ident-off") : (NSString *)@""] forCount:2.5];
[self playMissileSafe];
}
else
{

View File

@ -677,6 +677,8 @@ BOOL class_masslocks(int some_class);
- (BOOL) fireLaserShotInDirection: (OOViewID) direction;
- (BOOL) firePlasmaShot:(double) offset :(double) speed :(OOColor *) color;
- (BOOL) fireMissile;
- (BOOL) isMissileFlag;
- (void) setIsMissileFlag:(BOOL)newValue;
- (BOOL) fireECM;
- (BOOL) activateCloakingDevice;
- (void) deactivateCloakingDevice;

View File

@ -6528,7 +6528,7 @@ BOOL class_masslocks(int some_class)
[missile setSpeed:150.0];
[missile setDistanceTravelled:0.0];
[missile setStatus:STATUS_IN_FLIGHT]; // necessary to get it going!
missile->isMissile = YES;
[missile setIsMissileFlag:YES];
[missile resetShotTime];
[UNIVERSE addEntity:missile];
@ -6546,6 +6546,18 @@ BOOL class_masslocks(int some_class)
}
- (BOOL) isMissileFlag
{
return isMissile; // were we created using fireMissile? (for tracking submunitions)
}
- (void) setIsMissileFlag:(BOOL)newValue
{
isMissile = !!newValue; // set the isMissile flag, used for tracking submunitions
}
// Exposed to AI
- (BOOL) fireECM
{

View File

@ -82,7 +82,7 @@ extern NSString * const kOOLogNoteAddShips;
{
[spawned setOwner:[self owner]];
[spawned addTarget:[self primaryTarget]];
spawned->isMissile = YES;
[spawned setIsMissileFlag:YES];
}
[result addObject:spawned];
}