Cleaned up oolite-default-ship-script.js for strict mode.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3963 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2011-01-03 00:27:00 +00:00
parent dc07d56bf6
commit 4fac70192f
3 changed files with 4 additions and 7 deletions

View File

@ -29,7 +29,7 @@ MA 02110-1301, USA.
/*jslint white: true, undef: true, eqeqeq: true, bitwise: true, regexp: true, newcap: true, immed: true */
// "use strict"; //FIXME: can't delete legacy_fooActions.
"use strict";
this.name = "oolite-default-ship-script";
@ -50,9 +50,7 @@ if (this.legacy_launchActions !== undefined)
*/
this.ship.runLegacyScriptActions(this.ship, this.legacy_launchActions);
// These can only be used once; keeping them around after that is pointless.
delete this.shipSpawned;
delete this.legacy_launchActions;
};
}
@ -110,5 +108,4 @@ if (this.legacy_setupActions !== undefined)
future. Do not use it in your own scripts.
*/
this.ship.runLegacyScriptActions(this.ship, this.legacy_setupActions);
delete this.legacy_setupActions;
}

View File

@ -5238,7 +5238,7 @@ NSComparisonResult ComparePlanetsBySurfaceDistance(id i1, id i2, void* context)
if (actions) [properties setObject:actions forKey:@"legacy_setupActions"];
script = [OOScript JSScriptFromFileNamed:@"oolite-default-ship-script.js"
properties:properties];
properties:properties];
}
[script retain];
}

View File

@ -332,8 +332,8 @@ static void ReportJSError(JSContext *context, const char *message, JSErrorReport
// Run prefix script.
[OOJSScript JSScriptFromFileNamed:@"oolite-global-prefix.js"
properties:[NSDictionary dictionaryWithObject:JSSpecialFunctionsObjectWrapper(mainContext)
forKey:@"special"]];
properties:[NSDictionary dictionaryWithObject:JSSpecialFunctionsObjectWrapper(mainContext)
forKey:@"special"]];
OOLog(@"script.javaScript.init.success", @"Set up JavaScript context.");