Added extra paranoid code to avoid ships targetting temselves.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2891 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2009-12-17 15:05:10 +00:00
parent ca8bdfa70e
commit c2f3758b2b

View File

@ -5949,7 +5949,17 @@ BOOL class_masslocks(int some_class)
- (id) primaryTarget
{
return [UNIVERSE entityForUniversalID:primaryTarget];
id result = [UNIVERSE entityForUniversalID:primaryTarget];
if (EXPECT_NOT(result == self))
{
/* Added in response to a crash report showing recursion in
[PlayerEntity hasHostileTarget].
-- Ahruman 2009-12-17
*/
result = nil;
primaryTarget = NO_TARGET;
}
return result;
}