Enabled removal of damaged items in ShipEntity's -removeEquipmentItem method.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2521 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Nikos Barkas 2009-09-19 13:14:13 +00:00
parent 8a03448848
commit 55c6dcc6fb

View File

@ -2036,7 +2036,14 @@ ShipEntity* doOctreesCollide(ShipEntity* prime, ShipEntity* other)
- (void) removeEquipmentItem:(NSString *)equipmentKey
{
OOEquipmentType *eqType = [OOEquipmentType equipmentTypeWithIdentifier:equipmentKey];
NSString *equipmentTypeCheckKey = equipmentKey;
// determine the equipment type and make sure it works also in the case of damaged equipment
if ([equipmentKey hasSuffix:@"_DAMAGED"])
{
equipmentTypeCheckKey = [equipmentKey substringToIndex:[equipmentKey length] - [@"_DAMAGED" length]];
}
OOEquipmentType *eqType = [OOEquipmentType equipmentTypeWithIdentifier:equipmentTypeCheckKey];
if (eqType == nil) return;
if ([eqType isMissileOrMine])