- Defining a null value for EquipmentInfo.effectiveTechLevel will now delete the corresponding missionVariable

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2907 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Eric Walch 2009-12-24 09:28:37 +00:00
parent c010a69056
commit b14dae24b3
2 changed files with 10 additions and 0 deletions

View File

@ -1461,6 +1461,8 @@ static WormholeEntity *whole = nil;
NSEnumerator *shipEnum = nil;
ShipEntity *target = nil, *ship = nil;
if (primaryTarget == NO_TARGET) return;
if ([self group] == nil) // ship is alone!
{
found_target = primaryTarget;

View File

@ -253,6 +253,14 @@ static JSBool EquipmentInfoSetProperty(JSContext *context, JSObject *this, jsval
{
case kEquipmentInfo_effectiveTechLevel:
if ([eqType techLevel] != kOOVariableTechLevel) return YES; // Only TL-99 items can be modified in this way
if (JSVAL_IS_NULL(*value))
{
// reset mission variable
[OOPlayerForScripting() setMissionVariable:nil
forKey:[@"mission_TL_FOR_" stringByAppendingString:[eqType identifier]]];
OK = YES;
break;
}
if (JS_ValueToInt32(context, *value, &iValue))
{
if (iValue < 0) iValue = 0;