- fix: no more mission.runScreen flight related crashes.

- more js missions cleanup.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2783 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Marc 2009-11-26 02:32:12 +00:00
parent 7d870400f1
commit 472b08f9af
4 changed files with 13 additions and 15 deletions

View File

@ -109,7 +109,7 @@ this.missionOffers = function ()
if (galaxyNumber < 2 && !missionVariables.conhunt && player.score > 255)
{
// there are no options to deal with, we don't need a callback function.
mission.runScreen({titleKey:"constrictor_hunt_title", messageKey:"constrictor_hunt_brief1", model: "constrictor"}, null);
mission.runScreen({titleKey:"constrictor_hunt_title", messageKey:"constrictor_hunt_brief1", model: "constrictor"});
if (galaxyNumber === 0)
{
mission.addMessageTextKey("constrictor_hunt_brief1a"); // galaxy = 0
@ -124,7 +124,7 @@ this.missionOffers = function ()
}
if (missionVariables.conhunt === "CONSTRICTOR_DESTROYED") // Variable is set by the ship script
{
mission.runScreen({titleKey:"constrictor_hunt_title", messageKey:"constrictor_hunt_debrief", model: "constrictor"}, null);
mission.runScreen({titleKey:"constrictor_hunt_title", messageKey:"constrictor_hunt_debrief", model: "constrictor"});
player.credits += 5000;
player.bounty = 0; // legal status
player.score += 256; // ship kills

View File

@ -57,26 +57,26 @@ this.missionOffers = function ()
if (missionVariables.nova === "NOVA_ESCAPED_SYSTEM")
{
player.ship.removeAllCargo();
mission.runScreen({titleKey:"oolite_nova_title", messageKey:"oolite_nova_hero", background:"solar.png"}, null);
mission.runScreen({titleKey:"oolite_nova_title", messageKey:"oolite_nova_hero", background:"solar.png"});
player.ship.manifest["Gem-Stones"] += 100;
this.endTheMission();
}
else if (missionVariables.nova === "NOVA_ESCAPE_POD")
{
player.ship.removeAllCargo(); // can only be done while docked.
mission.runScreen({titleKey:"oolite_nova_title", messageKey:"oolite_nova_disappointed", background:"solar.png"}, null);
mission.runScreen({titleKey:"oolite_nova_title", messageKey:"oolite_nova_disappointed", background:"solar.png"});
this.endTheMission();
}
else if (missionVariables.nova === "NOVA_ESCAPE_OTHER")
{
mission.runScreen({titleKey:"oolite_nova_title", messageKey:"oolite_nova_ignored", background:"solar.png"}, null);
mission.runScreen({titleKey:"oolite_nova_title", messageKey:"oolite_nova_ignored", background:"solar.png"});
this.endTheMission();
}
else if (missionVariables.nova === "NOVA_ESCAPE_COWARD" && !system.sun.isGoingNova && !system.sun.hasGoneNova)
{
player.decreaseContractReputation();
player.decreasePassengerReputation();
mission.runScreen({titleKey:"oolite_nova_title", messageKey:"oolite_nova_disappointed", background:"solar.png"}, null);
mission.runScreen({titleKey:"oolite_nova_title", messageKey:"oolite_nova_disappointed", background:"solar.png"});
this.endTheMission();
}
}

View File

@ -49,7 +49,7 @@ this.missionOffers = function ()
player.score > 1280 &&
system.ID !== 83)
{
mission.runScreen({titleKey:"thargoid_plans_title", messageKey:"thargoid_plans_brief1"}, null);
mission.runScreen({titleKey:"thargoid_plans_title", messageKey:"thargoid_plans_brief1"});
missionVariables.thargplans = "PRELUDE";
mission.setInstructionsKey("thargoid_plans_info1");
mission.markSystem(83);
@ -58,7 +58,7 @@ this.missionOffers = function ()
system.ID === 83)
{
mission.unmarkSystem(83);
mission.runScreen({titleKey:"thargoid_plans_title", messageKey:"thargoid_plans_brief2", model: "thargoid"}, null);
mission.runScreen({titleKey:"thargoid_plans_title", messageKey:"thargoid_plans_brief2", model: "thargoid"});
missionVariables.thargplans = "RUNNING";
mission.setInstructionsKey("thargoid_plans_info2");
mission.markSystem(36);
@ -66,7 +66,7 @@ this.missionOffers = function ()
else if (missionVariables.thargplans === "RUNNING" &&
system.ID === 36)
{
mission.runScreen({titleKey:"thargoid_plans_title", messageKey:"thargoid_plans_debrief", model: "thargoid"}, null);
mission.runScreen({titleKey:"thargoid_plans_title", messageKey:"thargoid_plans_debrief", model: "thargoid"});
player.score += 256; // ship kills
mission.setInstructions(null); // reset the mission briefing
missionVariables.thargplans = "MISSION_COMPLETE";

View File

@ -402,9 +402,8 @@ static JSBool MissionRunScreen(JSContext *context, JSObject *this, uintN argc, j
if (argc>0) {
if (!JSVAL_IS_NULL(argv[0]) && !JSVAL_IS_VOID(argv[0]) && !JSVAL_IS_OBJECT(argv[0]))
{
OOReportJSBadArguments(context, nil, @"Mission.runScreen", 1, argv, @"Invalid argument", @"object");
*outResult = BOOLToJSVal(NO);
return YES;
OOReportJSBadArguments(context, @"Mission", @"runScreen", 1, argv, @"Invalid argument", @"object");
return NO;
}
if (!JSVAL_IS_NULL(argv[0]) && !JSVAL_IS_VOID(argv[0]) && JSVAL_IS_OBJECT(argv[0])) params = JSVAL_TO_OBJECT(argv[0]);
@ -413,9 +412,8 @@ static JSBool MissionRunScreen(JSContext *context, JSObject *this, uintN argc, j
if (argc > 1) function = argv[1];
if (!JSVAL_IS_OBJECT(function) || (!JSVAL_IS_NULL(function) && !JS_ObjectIsFunction(context, JSVAL_TO_OBJECT(function))))
{
OOReportJSBadArguments(context, nil, @"Mission.runScreen", 1, argv + 1, @"Invalid argument", @"function");
*outResult = BOOLToJSVal(NO);
return YES;
OOReportJSBadArguments(context, @"Mission", @"runScreen", 1, argv + 1, @"Invalid argument", @"function");
return NO;
}
str=@"title";