Add background/overlay to no-contract summary pages for interfaces.

Add extra safety check to cargo contract generator.


git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@5501 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Chris Morris 2012-11-14 19:57:04 +00:00
parent e91e9d688b
commit e1c5326e28
3 changed files with 39 additions and 10 deletions

View File

@ -348,7 +348,8 @@ this._initialiseCargoContractsForSystem = function()
// higher share for transporter for longer routes, less safe systems
var share = 100 + destinationInfo.government - (10*routeToDestination.route.length);
if (share < 10) {
if (share < 10)
{
share = 10;
}
share = 100-share;
@ -358,6 +359,11 @@ this._initialiseCargoContractsForSystem = function()
cargo.payment = fee;
cargo.deposit = localValue - (localValue % 20);
if (cargo.deposit >= cargo.payment)
{
// rare but not impossible; last safety check
return;
}
// time allowed for delivery is time taken by "fewest jumps"
// route, plus timer above. Higher reputation makes longer
@ -432,11 +438,18 @@ this._cargoContractsDisplay = function(summary) {
// the last one) display a message and quit.
if (this.$contracts.length === 0)
{
mission.runScreen({titleKey: "oolite-contracts-cargo-none-available-title",
var missionConfig = {titleKey: "oolite-contracts-cargo-none-available-title",
messageKey: "oolite-contracts-cargo-none-available-message",
allowInterrupt: true,
screenID: "oolite-contracts-cargo-none",
exitScreen: "GUI_SCREEN_INTERFACES"});
exitScreen: "GUI_SCREEN_INTERFACES"};
if (this.$cargoSummaryPageBackground != "") {
missionConfig.background = this.$cargoSummaryPageBackground;
}
if (this.$cargoPageOverlay != "") {
missionConfig.overlay = this.$cargoPageOverlay;
}
mission.runScreen(missionConfig);
// no callback, just exits contracts system
return;
}

View File

@ -360,11 +360,19 @@ this._parcelContractsDisplay = function(summary) {
// the last one) display a message and quit.
if (this.$parcels.length === 0)
{
mission.runScreen({titleKey: "oolite-contracts-parcels-none-available-title",
var missionConfig = {titleKey: "oolite-contracts-parcels-none-available-title",
messageKey: "oolite-contracts-parcels-none-available-message",
allowInterrupt: true,
screenID: "oolite-contracts-parcels-none",
exitScreen: "GUI_SCREEN_INTERFACES"});
exitScreen: "GUI_SCREEN_INTERFACES"};
if (this.$parcelSummaryPageBackground != "") {
missionConfig.background = this.$parcelSummaryPageBackground;
}
if (this.$parcelPageOverlay != "") {
missionConfig.overlay = this.$parcelPageOverlay;
}
mission.runScreen(missionConfig);
// no callback, just exits contracts system
return;
}

View File

@ -372,11 +372,19 @@ this._passengerContractsDisplay = function(summary) {
// the last one) display a message and quit.
if (this.$passengers.length === 0)
{
mission.runScreen({titleKey: "oolite-contracts-passengers-none-available-title",
messageKey: "oolite-contracts-passengers-none-available-message",
allowInterrupt: true,
screenID: "oolite-contracts-passengers-none",
exitScreen: "GUI_SCREEN_INTERFACES"});
var missionConfig = {titleKey: "oolite-contracts-passengers-none-available-title",
messageKey: "oolite-contracts-passengers-none-available-message",
allowInterrupt: true,
screenID: "oolite-contracts-passengers-none",
exitScreen: "GUI_SCREEN_INTERFACES"};
if (this.$passengerSummaryPageBackground != "") {
missionConfig.background = this.$passengerSummaryPageBackground;
}
if (this.$passengerPageOverlay != "") {
missionConfig.overlay = this.$passengerPageOverlay;
}
mission.runScreen(missionConfig);
// no callback, just exits contracts system
return;
}