From 9d23e7b36d4c454661b0050b49d9c1dfd3d450c1 Mon Sep 17 00:00:00 2001 From: Chris Morris Date: Sun, 17 Feb 2013 12:17:35 +0000 Subject: [PATCH] Fix one "ghost entity" bug. Hopefully this hints at where the others might be. git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@5640 127b21dd-08f5-0310-b4b7-95ae10353056 --- src/Core/Entities/ShipEntity.m | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Core/Entities/ShipEntity.m b/src/Core/Entities/ShipEntity.m index 28804447..6dbbaf6a 100644 --- a/src/Core/Entities/ShipEntity.m +++ b/src/Core/Entities/ShipEntity.m @@ -11347,6 +11347,17 @@ Vector positionOffsetForShipInRotationToAlignment(ShipEntity* ship, Quaternion q if (max_cargo && [cargo count] >= [self maxAvailableCargoSpace]) [shipAI message:@"HOLD_FULL"]; } [self doScriptEvent:OOJSID("shipScoopedOther") withArgument:other]; // always fire, even without commodity. + + // if shipScoopedOther does something strange to the object, we must + // then remove it from the hold, or it will be over-retained + if ([other status] != STATUS_IN_HOLD) + { + if ([cargo containsObject:other]) + { + [cargo removeObject:other]; + } + } + [[other collisionArray] removeObject:self]; // so it can't be scooped twice! // make sure other ships trying to scoop it lose it // probably already happened, but some may have acquired it