Remove Strict Mode

Replace strict mode control with OXP enable/disable control
Display OXP setting on new game ship parade to make it clearer to users why their OXPs aren't loading
Adjust descriptions
Remove all gameplay differences other than OXP loading in strict mode
This commit is contained in:
cim 2013-06-29 10:21:35 +01:00
parent 52f953f7b0
commit 848e59ce19
12 changed files with 138 additions and 270 deletions

View File

@ -1073,8 +1073,8 @@
"options-begin-new-game" = " Begin New Game "; "options-begin-new-game" = " Begin New Game ";
"options-game-options" = " Game Options… "; "options-game-options" = " Game Options… ";
"options-exit-game" = " Exit Game "; "options-exit-game" = " Exit Game ";
"options-reset-to-unrestricted-play" = " Reset to Unrestricted Play "; "options-reset-to-unrestricted-play" = " Reset and enable OXPs ";
"options-reset-to-strict-play" = " Reset to Strict Play "; "options-reset-to-strict-play" = " Reset and disable OXPs ";
// Gameoptions screen // Gameoptions screen
"gameoptions-autosave-yes" = " Autosave: On "; "gameoptions-autosave-yes" = " Autosave: On ";
@ -1269,7 +1269,7 @@
"loadfailed-no-file-specified" = "No file specified."; "loadfailed-no-file-specified" = "No file specified.";
"loadfailed-could-not-load-file" = "Could not load file."; "loadfailed-could-not-load-file" = "Could not load file.";
"loadfailed-could-not-use-ship-type-@-please-switch-to-unrestricted" "loadfailed-could-not-use-ship-type-@-please-switch-to-unrestricted"
= "Unable to use ship type “%@” in strict mode - please switch to unrestricted mode first."; = "Unable to use ship type “%@” when OXPs are disabled. Please re-enable OXPs";
"loadfailed-could-not-find-ship-type-@-please-reinstall-the-appropriate-OXP" "loadfailed-could-not-find-ship-type-@-please-reinstall-the-appropriate-OXP"
= "Could not find ship type “%@” - please reinstall the appropriate OXP."; = "Could not find ship type “%@” - please reinstall the appropriate OXP.";
"loadfailed-invalid-saved-game-no-ship-specified" "loadfailed-invalid-saved-game-no-ship-specified"
@ -1303,8 +1303,8 @@
"no-target-string" = "No target"; "no-target-string" = "No target";
"communications-log-string" = "Communications Log"; "communications-log-string" = "Communications Log";
"adjusting-word" = " (adjusting)"; "adjusting-word" = " (adjusting)";
"strict-play-enabled" = "Strict Play Enabled"; "strict-play-enabled" = "OXP loading disabled";
"unrestricted-play-enabled" = "Unrestricted Play Enabled"; "unrestricted-play-enabled" = "OXP loading enabled";
"human-word" = "human"; // Important only lower case characters here! "human-word" = "human"; // Important only lower case characters here!
"human-colonial-description%0" = "Human Colonial"; "human-colonial-description%0" = "Human Colonial";
"human-colonial-description%1" = "Human Colonials"; "human-colonial-description%1" = "Human Colonials";

View File

@ -908,10 +908,8 @@ static GLfloat sBaseMass = 0.0;
if ([dict oo_boolForKey:@"has_ecm"]) [equipment oo_setBool:YES forKey:@"EQ_ECM"]; if ([dict oo_boolForKey:@"has_ecm"]) [equipment oo_setBool:YES forKey:@"EQ_ECM"];
if ([dict oo_boolForKey:@"has_scoop"]) [equipment oo_setBool:YES forKey:@"EQ_FUEL_SCOOPS"]; if ([dict oo_boolForKey:@"has_scoop"]) [equipment oo_setBool:YES forKey:@"EQ_FUEL_SCOOPS"];
if ([dict oo_boolForKey:@"has_energy_bomb"]) [equipment oo_setBool:YES forKey:@"EQ_ENERGY_BOMB"]; if ([dict oo_boolForKey:@"has_energy_bomb"]) [equipment oo_setBool:YES forKey:@"EQ_ENERGY_BOMB"];
if (!strict)
{
if ([dict oo_boolForKey:@"has_fuel_injection"]) [equipment oo_setBool:YES forKey:@"EQ_FUEL_INJECTION"]; if ([dict oo_boolForKey:@"has_fuel_injection"]) [equipment oo_setBool:YES forKey:@"EQ_FUEL_INJECTION"];
}
// Legacy energy unit type -> energy unit equipment item // Legacy energy unit type -> energy unit equipment item
if ([dict oo_boolForKey:@"has_energy_unit"] && [self installedEnergyUnitType] == ENERGY_UNIT_NONE) if ([dict oo_boolForKey:@"has_energy_unit"] && [self installedEnergyUnitType] == ENERGY_UNIT_NONE)
@ -933,7 +931,7 @@ static GLfloat sBaseMass = 0.0;
} }
} }
/* Energy bombs are no longer supported in non-strict mode. As compensation, /* Energy bombs are no longer supported without OXPs. As compensation,
we'll award either a Q-mine or some cash. We can't determine what to we'll award either a Q-mine or some cash. We can't determine what to
award until we've handled missiles later on, though. award until we've handled missiles later on, though.
*/ */
@ -972,19 +970,6 @@ static GLfloat sBaseMass = 0.0;
[contracts release]; [contracts release];
[contract_record release]; [contract_record release];
// Don't load passengers & contracts in strict mode savegames!
if ([UNIVERSE strict])
{
max_passengers = 0;
passengers = nil;
passenger_record = nil;
contracts = nil;
contract_record = nil;
parcels = nil;
parcel_record = nil;
}
else
{
max_passengers = [dict oo_intForKey:@"max_passengers" defaultValue:0]; max_passengers = [dict oo_intForKey:@"max_passengers" defaultValue:0];
passengers = [[dict oo_arrayForKey:@"passengers"] mutableCopy]; passengers = [[dict oo_arrayForKey:@"passengers"] mutableCopy];
passenger_record = [[dict oo_dictionaryForKey:@"passenger_record"] mutableCopy]; passenger_record = [[dict oo_dictionaryForKey:@"passenger_record"] mutableCopy];
@ -993,7 +978,7 @@ static GLfloat sBaseMass = 0.0;
parcels = [[dict oo_arrayForKey:@"parcels"] mutableCopy]; parcels = [[dict oo_arrayForKey:@"parcels"] mutableCopy];
parcel_record = [[dict oo_dictionaryForKey:@"parcel_record"] mutableCopy]; parcel_record = [[dict oo_dictionaryForKey:@"parcel_record"] mutableCopy];
}
if (passengers == nil) passengers = [[NSMutableArray alloc] init]; if (passengers == nil) passengers = [[NSMutableArray alloc] init];
if (passenger_record == nil) passenger_record = [[NSMutableDictionary alloc] init]; if (passenger_record == nil) passenger_record = [[NSMutableDictionary alloc] init];
@ -2642,14 +2627,6 @@ static GLfloat sBaseMass = 0.0;
else velocity = vector_multiply_scalar(velocity, velmag2 / velmag); else velocity = vector_multiply_scalar(velocity, velmag2 / velmag);
} }
if ([UNIVERSE strict])
{
if (velmag2 < OG_ELITE_FORWARD_DRIFT)
{
// add acceleration
velocity = vector_add(velocity, vector_multiply_scalar(v_forward, (float)delta_t * OG_ELITE_FORWARD_DRIFT * 20.0f));
}
}
UPDATE_STAGE(@"updating joystick"); UPDATE_STAGE(@"updating joystick");
[self applyRoll:(float)delta_t*flightRoll andClimb:(float)delta_t*flightPitch]; [self applyRoll:(float)delta_t*flightRoll andClimb:(float)delta_t*flightPitch];
@ -4982,8 +4959,6 @@ static GLfloat sBaseMass = 0.0;
[self markAsOffender:64 withReason:kOOLegalStatusReasonAttackedPolice]; [self markAsOffender:64 withReason:kOOLegalStatusReasonAttackedPolice];
} }
if (![UNIVERSE strict]) // only mess with the scores if we're not in 'strict' mode
{
BOOL killIsCargo = ((killClass == CLASS_CARGO) && ([other commodityAmount] > 0) && ![other isHulk]); BOOL killIsCargo = ((killClass == CLASS_CARGO) && ([other commodityAmount] > 0) && ![other isHulk]);
if ((killIsCargo) || (killClass == CLASS_BUOY) || (killClass == CLASS_ROCK)) if ((killIsCargo) || (killClass == CLASS_BUOY) || (killClass == CLASS_ROCK))
{ {
@ -4994,7 +4969,6 @@ static GLfloat sBaseMass = 0.0;
killAward = NO; // don't award a kill killAward = NO; // don't award a kill
} }
} }
}
credits += score; credits += score;
@ -5088,8 +5062,7 @@ static GLfloat sBaseMass = 0.0;
[self setScriptTarget:self]; [self setScriptTarget:self];
[UNIVERSE clearPreviousMessage]; [UNIVERSE clearPreviousMessage];
[self removeEquipmentItem:system_key]; [self removeEquipmentItem:system_key];
if (![UNIVERSE strict])
{
NSString *damagedKey = [NSString stringWithFormat:@"%@_DAMAGED", system_key]; NSString *damagedKey = [NSString stringWithFormat:@"%@_DAMAGED", system_key];
[self addEquipmentItem:damagedKey withValidation: NO inContext:@"damage"]; // for possible future repair. [self addEquipmentItem:damagedKey withValidation: NO inContext:@"damage"]; // for possible future repair.
[self doScriptEvent:OOJSID("equipmentDamaged") withArgument:system_key]; [self doScriptEvent:OOJSID("equipmentDamaged") withArgument:system_key];
@ -5104,15 +5077,6 @@ static GLfloat sBaseMass = 0.0;
*/ */
[UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"@-damaged"), system_name] forCount:4.5]; [UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"@-damaged"), system_name] forCount:4.5];
} }
}
else
{
[self doScriptEvent:OOJSID("equipmentDestroyed") withArgument:system_key];
if (![self hasEquipmentItem:system_name]) // Because script may have undestroyed it
{
[UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"@-destroyed"), system_name] forCount:4.5];
}
}
// if Docking Computers have been selected to take damage and they happen to be on, switch them off // if Docking Computers have been selected to take damage and they happen to be on, switch them off
if ([system_key isEqualToString:@"EQ_DOCK_COMP"] && autopilot_engaged) if ([system_key isEqualToString:@"EQ_DOCK_COMP"] && autopilot_engaged)
@ -5284,7 +5248,7 @@ static GLfloat sBaseMass = 0.0;
// Did we fail to observe traffic control regulations? However, due to the state of emergency, // Did we fail to observe traffic control regulations? However, due to the state of emergency,
// apply no unauthorized docking penalties if a nova is ongoing. // apply no unauthorized docking penalties if a nova is ongoing.
if (![UNIVERSE strict] && [dockedStation requiresDockingClearance] && if ([dockedStation requiresDockingClearance] &&
![self clearedToDock] && ![[UNIVERSE sun] willGoNova]) ![self clearedToDock] && ![[UNIVERSE sun] willGoNova])
{ {
[self penaltyForUnauthorizedDocking]; [self penaltyForUnauthorizedDocking];
@ -5984,7 +5948,7 @@ static GLfloat sBaseMass = 0.0;
{ {
[quip addObject:[NSArray arrayWithObjects:[eqType name], [NSNumber numberWithBool:YES], nil]]; [quip addObject:[NSArray arrayWithObjects:[eqType name], [NSNumber numberWithBool:YES], nil]];
} }
else if (![UNIVERSE strict]) else
{ {
// Check for damaged version // Check for damaged version
if ([self hasEquipmentItem:[[eqType identifier] stringByAppendingString:@"_DAMAGED"]]) if ([self hasEquipmentItem:[[eqType identifier] stringByAppendingString:@"_DAMAGED"]])
@ -6901,7 +6865,7 @@ static NSString *last_outfitting_key=nil;
if (minTechLevel != 0 && [self hasEquipmentItem:[eqType damagedIdentifier]]) minTechLevel--; if (minTechLevel != 0 && [self hasEquipmentItem:[eqType damagedIdentifier]]) minTechLevel--;
// reduce the minimum techlevel occasionally as a bonus.. // reduce the minimum techlevel occasionally as a bonus..
if (![UNIVERSE strict] && techlevel < minTechLevel && techlevel + 3 > minTechLevel) if (techlevel < minTechLevel && techlevel + 3 > minTechLevel)
{ {
unsigned day = i * 13 + (unsigned)floor([UNIVERSE getTime] / 86400.0); unsigned day = i * 13 + (unsigned)floor([UNIVERSE getTime] / 86400.0);
unsigned char dayRnd = (day & 0xff) ^ system_seed.a; unsigned char dayRnd = (day & 0xff) ^ system_seed.a;
@ -7486,6 +7450,7 @@ static NSString *last_outfitting_key=nil;
} }
else else
{ {
[gui setText:([UNIVERSE strict])? DESC(@"strict-play-enabled"):DESC(@"unrestricted-play-enabled") forRow:1 align:GUI_ALIGN_CENTER];
text = DESC(@"press-space-commander"); text = DESC(@"press-space-commander");
[gui setText:text forRow:21 align:GUI_ALIGN_CENTER]; [gui setText:text forRow:21 align:GUI_ALIGN_CENTER];
[gui setColor:[OOColor yellowColor] forRow:21]; [gui setColor:[OOColor yellowColor] forRow:21];
@ -9461,10 +9426,8 @@ static NSString *last_outfitting_key=nil;
#if MASS_DEPENDENT_FUEL_PRICES #if MASS_DEPENDENT_FUEL_PRICES
- (GLfloat) fuelChargeRate - (GLfloat) fuelChargeRate
{ {
GLfloat rate = 1.0; // Standard (& strict play) charge rate. GLfloat rate = 1.0; // Standard charge rate.
if (![UNIVERSE strict])
{
rate = [super fuelChargeRate]; rate = [super fuelChargeRate];
// Experimental: the state of repair affects the fuel charge rate - more fuel needed for jumps, etc... // Experimental: the state of repair affects the fuel charge rate - more fuel needed for jumps, etc...
@ -9473,7 +9436,7 @@ static NSString *last_outfitting_key=nil;
rate *= 2.0 - (ship_trade_in_factor / 100); // between 1.1x and 1.25x rate *= 2.0 - (ship_trade_in_factor / 100); // between 1.1x and 1.25x
//OOLog(@"fuelPrices", @"\"%@\" - repair status: %d%%, adjusted rate to:%.2f)", [self shipDataKey], ship_trade_in_factor, rate); //OOLog(@"fuelPrices", @"\"%@\" - repair status: %d%%, adjusted rate to:%.2f)", [self shipDataKey], ship_trade_in_factor, rate);
} }
}
return rate; return rate;
} }
#endif #endif
@ -9599,7 +9562,7 @@ else _dockTarget = NO_TARGET;
OOCreditsQuantity calculatedFine = credits * 0.05; OOCreditsQuantity calculatedFine = credits * 0.05;
OOCreditsQuantity maximumFine = 50000ULL; OOCreditsQuantity maximumFine = 50000ULL;
if ([UNIVERSE strict] || [self clearedToDock]) if ([self clearedToDock])
return; return;
amountToPay = MIN(maximumFine, calculatedFine); amountToPay = MIN(maximumFine, calculatedFine);

View File

@ -62,8 +62,6 @@ static NSString * const kOOLogNoteShowShipyardModel = @"script.debug.note.showSh
- (NSString *) processEscapePods // removes pods from cargo bay and treats categories of characters carried - (NSString *) processEscapePods // removes pods from cargo bay and treats categories of characters carried
{ {
if ([UNIVERSE strict]) return @"";
unsigned i; unsigned i;
BOOL added_entry = NO; // to prevent empty lines for slaves and the rare empty report. BOOL added_entry = NO; // to prevent empty lines for slaves and the rare empty report.
NSMutableString *result = [NSMutableString string]; NSMutableString *result = [NSMutableString string];

View File

@ -896,8 +896,8 @@ static NSTimeInterval time_last_frame;
} }
exceptionContext = @"weapons online toggle"; exceptionContext = @"weapons online toggle";
// weapons online / offline toggle '_' - non-strict mode only // weapons online / offline toggle '_'
if (([gameView isDown:key_weapons_online_toggle] || joyButtonState[BUTTON_WEAPONSONLINETOGGLE]) && ![UNIVERSE strict]) if (([gameView isDown:key_weapons_online_toggle] || joyButtonState[BUTTON_WEAPONSONLINETOGGLE]))
{ {
if (!weaponsOnlineToggle_pressed) if (!weaponsOnlineToggle_pressed)
{ {
@ -1149,7 +1149,7 @@ static NSTimeInterval time_last_frame;
// user defaults file. // user defaults file.
if (([gameView isDown:key_launch_escapepod] || joyButtonState[BUTTON_ESCAPE]) && [self hasEscapePod]) if (([gameView isDown:key_launch_escapepod] || joyButtonState[BUTTON_ESCAPE]) && [self hasEscapePod])
{ {
BOOL goodToLaunch = [UNIVERSE strict] || [[NSUserDefaults standardUserDefaults] boolForKey:@"escape-pod-activation-immediate"]; BOOL goodToLaunch = [[NSUserDefaults standardUserDefaults] boolForKey:@"escape-pod-activation-immediate"];
static OOTimeDelta escapePodKeyResetTime; static OOTimeDelta escapePodKeyResetTime;
if (!goodToLaunch) if (!goodToLaunch)
@ -1225,8 +1225,8 @@ static NSTimeInterval time_last_frame;
} }
exceptionContext = @"docking clearance request"; exceptionContext = @"docking clearance request";
// docking clearance request 'L', not available in strict mode
if ([gameView isDown:key_docking_clearance_request] && ![UNIVERSE strict]) if ([gameView isDown:key_docking_clearance_request])
{ {
if (!docking_clearance_request_key_pressed) if (!docking_clearance_request_key_pressed)
{ {
@ -1631,7 +1631,7 @@ static NSTimeInterval time_last_frame;
} }
case GUI_SCREEN_SHORT_RANGE_CHART: case GUI_SCREEN_SHORT_RANGE_CHART:
show_info_flag = ([gameView isDown:key_map_info] && ![UNIVERSE strict]); show_info_flag = ([gameView isDown:key_map_info]);
// If we have entered this screen with the injectors key pressed, make sure // If we have entered this screen with the injectors key pressed, make sure
// that injectors switch off when we release it - Nikos. // that injectors switch off when we release it - Nikos.
@ -1771,19 +1771,6 @@ static NSTimeInterval time_last_frame;
} }
case GUI_SCREEN_SYSTEM_DATA: case GUI_SCREEN_SYSTEM_DATA:
/* if ([self status] == STATUS_DOCKED && dockedStation == [UNIVERSE station] && [gameView isDown:key_contract_info] && ![UNIVERSE strict] && [self hasHyperspaceMotor]) // '?' toggle between maps/info and contract screen
{
if (!queryPressed)
{
[self setGuiToContractsScreen];
if ((oldSelection >= (int)[gui selectableRange].location)&&(oldSelection < (int)[gui selectableRange].location + (int)[gui selectableRange].length))
[gui setSelectedRow:oldSelection];
[self setGuiToContractsScreen];
}
queryPressed = YES;
}
else
queryPressed = NO; */
break; break;
#if OO_USE_CUSTOM_LOAD_SAVE #if OO_USE_CUSTOM_LOAD_SAVE
@ -3070,8 +3057,6 @@ static NSTimeInterval time_last_frame;
} }
} }
if (![UNIVERSE strict])
{
yawing = NO; yawing = NO;
// if we have roll on the mouse x-axis, then allow using the keyboard yaw keys // if we have roll on the mouse x-axis, then allow using the keyboard yaw keys
if (!mouse_control_on || (mouse_control_on && !mouse_x_axis_map_to_yaw)) if (!mouse_control_on || (mouse_control_on && !mouse_x_axis_map_to_yaw))
@ -3123,7 +3108,7 @@ static NSTimeInterval time_last_frame;
else flightYaw = 0.0; else flightYaw = 0.0;
} }
} }
}
} }
@ -3148,7 +3133,7 @@ static NSTimeInterval time_last_frame;
if (!switching_status_screens) if (!switching_status_screens)
{ {
switching_status_screens = YES; switching_status_screens = YES;
if ((gui_screen == GUI_SCREEN_STATUS)&&(![UNIVERSE strict])) if (gui_screen == GUI_SCREEN_STATUS)
{ {
[self noteGUIWillChangeTo:GUI_SCREEN_MANIFEST]; [self noteGUIWillChangeTo:GUI_SCREEN_MANIFEST];
[self setGuiToManifestScreen]; [self setGuiToManifestScreen];
@ -3230,7 +3215,7 @@ static NSTimeInterval time_last_frame;
switching_equipship_screens = NO; switching_equipship_screens = NO;
} }
if ((([gameView isDown:gvFunctionKey4])||(fKeyAlias && [gameView isDown:gvNumberKey4])) && ![UNIVERSE strict]) if (([gameView isDown:gvFunctionKey4])||(fKeyAlias && [gameView isDown:gvNumberKey4]))
{ {
[self setGuiToInterfacesScreen:0]; [self setGuiToInterfacesScreen:0];
[gui setSelectedRow:GUI_ROW_INTERFACES_START]; [gui setSelectedRow:GUI_ROW_INTERFACES_START];
@ -3238,45 +3223,19 @@ static NSTimeInterval time_last_frame;
if (([gameView isDown:gvFunctionKey8])||(fKeyAlias && [gameView isDown:gvNumberKey8])) if (([gameView isDown:gvFunctionKey8])||(fKeyAlias && [gameView isDown:gvNumberKey8]))
{ {
/* if (!switching_market_screens)
{
if ((gui_screen == GUI_SCREEN_MARKET)&&(dockedStation == [UNIVERSE station])&&(![UNIVERSE strict] && [self hasHyperspaceMotor]))
{
[gameView clearKeys];
[self setGuiToContractsScreen];
[gui setSelectedRow:GUI_ROW_PASSENGERS_START];
}
else
{ */
[gameView clearKeys]; [gameView clearKeys];
[self noteGUIWillChangeTo:GUI_SCREEN_MARKET]; [self noteGUIWillChangeTo:GUI_SCREEN_MARKET];
[self setGuiToMarketScreen]; [self setGuiToMarketScreen];
[gui setSelectedRow:GUI_ROW_MARKET_START]; [gui setSelectedRow:GUI_ROW_MARKET_START];
/* }
}
switching_market_screens = YES;
}
else
{
switching_market_screens = NO;
*/
} }
} }
else else
{ {
if (([gameView isDown:gvFunctionKey8])||(fKeyAlias && [gameView isDown:gvNumberKey8])) if (([gameView isDown:gvFunctionKey8])||(fKeyAlias && [gameView isDown:gvNumberKey8]))
{ {
/* if (!switching_market_screens)
{ */
[self noteGUIWillChangeTo:GUI_SCREEN_MARKET]; [self noteGUIWillChangeTo:GUI_SCREEN_MARKET];
[self setGuiToMarketScreen]; [self setGuiToMarketScreen];
[gui setSelectedRow:GUI_ROW_MARKET_START]; [gui setSelectedRow:GUI_ROW_MARKET_START];
/* }
switching_market_screens = YES;
}
else
{
switching_market_screens = NO; */
} }
} }
} }

View File

@ -1016,8 +1016,15 @@ NSComparisonResult sortCommanders(id cdr1, id cdr2, void *context)
{ {
[self showShipyardModel:@"oolite-unknown-ship" shipData:nil personality:personality]; [self showShipyardModel:@"oolite-unknown-ship" shipData:nil personality:personality];
shipName = [cdr oo_stringForKey:@"ship_name" defaultValue:@"unknown"]; shipName = [cdr oo_stringForKey:@"ship_name" defaultValue:@"unknown"];
if ([UNIVERSE strict])
{
shipName = [shipName stringByAppendingString:@" - OXPs disabled"];
}
else
{
shipName = [shipName stringByAppendingString:@" - OXP not installed"]; shipName = [shipName stringByAppendingString:@" - OXP not installed"];
} }
}
// Make a short description of the commander // Make a short description of the commander
NSString *legalDesc = OODisplayStringFromLegalStatus([cdr oo_intForKey:@"legal_status"]); NSString *legalDesc = OODisplayStringFromLegalStatus([cdr oo_intForKey:@"legal_status"]);

View File

@ -317,15 +317,14 @@ static ShipEntity *doOctreesCollide(ShipEntity *prime, ShipEntity *other);
[self addEquipmentItem:@"EQ_QC_MINE" inContext:@"npc"]; [self addEquipmentItem:@"EQ_QC_MINE" inContext:@"npc"];
} }
} }
if (![UNIVERSE strict])
{
// These items are not available in strict mode.
if ([shipDict oo_fuzzyBooleanForKey:@"has_fuel_injection"]) [self addEquipmentItem:@"EQ_FUEL_INJECTION" inContext:@"npc"]; if ([shipDict oo_fuzzyBooleanForKey:@"has_fuel_injection"]) [self addEquipmentItem:@"EQ_FUEL_INJECTION" inContext:@"npc"];
#if USEMASC #if USEMASC
if ([shipDict oo_fuzzyBooleanForKey:@"has_military_jammer"]) [self addEquipmentItem:@"EQ_MILITARY_JAMMER" inContext:@"npc"]; if ([shipDict oo_fuzzyBooleanForKey:@"has_military_jammer"]) [self addEquipmentItem:@"EQ_MILITARY_JAMMER" inContext:@"npc"];
if ([shipDict oo_fuzzyBooleanForKey:@"has_military_scanner_filter"]) [self addEquipmentItem:@"EQ_MILITARY_SCANNER_FILTER" inContext:@"npc"]; if ([shipDict oo_fuzzyBooleanForKey:@"has_military_scanner_filter"]) [self addEquipmentItem:@"EQ_MILITARY_SCANNER_FILTER" inContext:@"npc"];
#endif #endif
}
// can it be 'mined' for alloys? // can it be 'mined' for alloys?
canFragment = [shipDict oo_fuzzyBooleanForKey:@"fragment_chance" defaultValue:0.9]; canFragment = [shipDict oo_fuzzyBooleanForKey:@"fragment_chance" defaultValue:0.9];
@ -335,15 +334,8 @@ static ShipEntity *doOctreesCollide(ShipEntity *prime, ShipEntity *other);
max_cargo = [shipDict oo_unsignedIntForKey:@"max_cargo"]; max_cargo = [shipDict oo_unsignedIntForKey:@"max_cargo"];
extra_cargo = [shipDict oo_unsignedIntForKey:@"extra_cargo" defaultValue:15]; extra_cargo = [shipDict oo_unsignedIntForKey:@"extra_cargo" defaultValue:15];
if (![UNIVERSE strict])
{
hyperspaceMotorSpinTime = [shipDict oo_floatForKey:@"hyperspace_motor_spin_time" defaultValue:DEFAULT_HYPERSPACE_SPIN_TIME]; hyperspaceMotorSpinTime = [shipDict oo_floatForKey:@"hyperspace_motor_spin_time" defaultValue:DEFAULT_HYPERSPACE_SPIN_TIME];
if(![shipDict oo_boolForKey:@"hyperspace_motor" defaultValue:YES]) hyperspaceMotorSpinTime = -1; if(![shipDict oo_boolForKey:@"hyperspace_motor" defaultValue:YES]) hyperspaceMotorSpinTime = -1;
}
else
{
hyperspaceMotorSpinTime = DEFAULT_HYPERSPACE_SPIN_TIME;
}
[name autorelease]; [name autorelease];
name = [[shipDict oo_stringForKey:@"name" defaultValue:@"?"] copy]; name = [[shipDict oo_stringForKey:@"name" defaultValue:@"?"] copy];
@ -2825,7 +2817,7 @@ ShipEntity* doOctreesCollide(ShipEntity* prime, ShipEntity* other)
for (eqTypeEnum = [eqTypes objectEnumerator]; (eqType = [eqTypeEnum nextObject]); ) for (eqTypeEnum = [eqTypes objectEnumerator]; (eqType = [eqTypeEnum nextObject]); )
{ {
// Equipment list, consistent with the rest of the API - Kaks // Equipment list, consistent with the rest of the API - Kaks
isDamaged = ![UNIVERSE strict] && [self hasEquipmentItem:[[eqType identifier] stringByAppendingString:@"_DAMAGED"]]; isDamaged = [self hasEquipmentItem:[[eqType identifier] stringByAppendingString:@"_DAMAGED"]];
if ([self hasEquipmentItem:[eqType identifier]] || isDamaged) if ([self hasEquipmentItem:[eqType identifier]] || isDamaged)
{ {
[quip addObject:eqType]; [quip addObject:eqType];
@ -3290,9 +3282,9 @@ ShipEntity* doOctreesCollide(ShipEntity* prime, ShipEntity* other)
_missileRole = nil; // use generic ship fallback from now on. _missileRole = nil; // use generic ship fallback from now on.
} }
// In unrestricted mode, assign random missiles 20% of the time without missile_role (or 10% with valid missile_role) // assign random missiles 20% of the time without missile_role (or 10% with valid missile_role)
if (chance > 0.8f && ![UNIVERSE strict]) role = @"missile"; if (chance > 0.8f) role = @"missile";
// otherwise use the standard role (100% of the time in restricted mode). // otherwise use the standard role
else role = @"EQ_MISSILE"; else role = @"EQ_MISSILE";
missileType = [self verifiedMissileTypeFromRole:role]; missileType = [self verifiedMissileTypeFromRole:role];
@ -7034,13 +7026,11 @@ NSComparisonResult ComparePlanetsBySurfaceDistance(id i1, id i2, void* context)
#if MASS_DEPENDENT_FUEL_PRICES #if MASS_DEPENDENT_FUEL_PRICES
if (![UNIVERSE strict])
{
if (EXPECT(PLAYER != nil && mass> 0 && mass != [PLAYER baseMass])) if (EXPECT(PLAYER != nil && mass> 0 && mass != [PLAYER baseMass]))
{ {
rate = calcFuelChargeRate(mass); rate = calcFuelChargeRate(mass);
} }
}
OOLog(@"fuelPrices", @"\"%@\" fuel charge rate: %.2f (mass ratio: %.2f/%.2f)", [self shipDataKey], rate, mass, [PLAYER baseMass]); OOLog(@"fuelPrices", @"\"%@\" fuel charge rate: %.2f (mass ratio: %.2f/%.2f)", [self shipDataKey], rate, mass, [PLAYER baseMass]);
#endif #endif

View File

@ -2263,8 +2263,6 @@ NSDictionary *OOMakeDockingInstructions(StationEntity *station, Vector coords, f
- (BOOL) hasShipyard - (BOOL) hasShipyard
{ {
if ([UNIVERSE strict])
return NO;
if ([UNIVERSE station] == self) if ([UNIVERSE station] == self)
return YES; return YES;
id determinant = [shipinfoDictionary objectForKey:@"has_shipyard"]; id determinant = [shipinfoDictionary objectForKey:@"has_shipyard"];

View File

@ -1834,7 +1834,7 @@ static OOTextureSprite *NewTextureSpriteWithDescriptor(NSDictionary *descriptor)
advancedNavArrayMode = OPTIMIZED_BY_TIME; advancedNavArrayMode = OPTIMIZED_BY_TIME;
} }
if (advancedNavArrayMode != OPTIMIZED_BY_NONE && ![UNIVERSE strict] && [player hasEquipmentItem:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"]) if (advancedNavArrayMode != OPTIMIZED_BY_NONE && [player hasEquipmentItem:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
{ {
OOSystemID planetNumber = [UNIVERSE findSystemNumberAtCoords:galaxy_coordinates withGalaxySeed:galaxy_seed]; OOSystemID planetNumber = [UNIVERSE findSystemNumberAtCoords:galaxy_coordinates withGalaxySeed:galaxy_seed];
OOSystemID destNumber = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxySeed:galaxy_seed]; OOSystemID destNumber = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxySeed:galaxy_seed];

View File

@ -203,12 +203,6 @@ static NSDictionary *sMissilesRegistry = nil;
extra = [info oo_dictionaryAtIndex:EQUIPMENT_EXTRA_INFO_INDEX]; extra = [info oo_dictionaryAtIndex:EQUIPMENT_EXTRA_INFO_INDEX];
if (extra != nil) if (extra != nil)
{ {
// Note: currently strict_mode_compatible is already handled by Universe, but at some point we want to get rid of Universe's equipmentData.
BOOL strictModeOnly = [extra oo_boolForKey:@"strict_mode_only" defaultValue:NO];
//BOOL strictModeCompatible = [extra oo_boolForKey:@"strict_mode_compatible" defaultValue:strictModeOnly]; // Wrong! Interprets explicitly set strict_mode_only = false as strict_mode_ompatible = false
BOOL strictModeCompatible = [extra oo_boolForKey:@"strict_mode_compatible" defaultValue:([extra objectForKey:@"strict_mode_only"] != nil)]; // if strict_mode_only is explicitely set, it's compatible with strict mode!
BOOL strict = [UNIVERSE strict];
if ((strict && !strictModeCompatible) || (!strict && strictModeOnly)) OK = NO;
_isAvailableToAll = [extra oo_boolForKey:@"available_to_all" defaultValue:_isAvailableToAll]; _isAvailableToAll = [extra oo_boolForKey:@"available_to_all" defaultValue:_isAvailableToAll];
_isAvailableToPlayer = [extra oo_boolForKey:@"available_to_player" defaultValue:_isAvailableToPlayer]; _isAvailableToPlayer = [extra oo_boolForKey:@"available_to_player" defaultValue:_isAvailableToPlayer];

View File

@ -546,9 +546,7 @@ static JSBool PlayerSetEscapePodDestination(JSContext *context, uintN argc, jsva
if ([UNIVERSE inInterstellarSpace]) if ([UNIVERSE inInterstellarSpace])
{ {
// Set 3.5 ly as the limit, enough to reach at least 2 systems! // Set 3.5 ly as the limit, enough to reach at least 2 systems!
// In strict mode the max rescue distance in witchspace would be 2.33ly: rescueRange = MAX_JUMP_RANGE / 2.0;
// 4.66 fuel to misjump there, 2.33 to fly back = 7ly fuel.
rescueRange = [UNIVERSE strict] ? MAX_JUMP_RANGE / 3.0 : MAX_JUMP_RANGE / 2.0;
} }
NSMutableArray *sDests = [UNIVERSE nearbyDestinationsWithinRange:rescueRange]; NSMutableArray *sDests = [UNIVERSE nearbyDestinationsWithinRange:rescueRange];
NSUInteger i = 0, nDests = [sDests count]; NSUInteger i = 0, nDests = [sDests count];

View File

@ -2107,13 +2107,6 @@ static JSBool ShipSetEquipmentStatus(JSContext *context, uintN argc, jsval *vp)
GET_THIS_SHIP(thisEnt); GET_THIS_SHIP(thisEnt);
if (EXPECT_NOT([UNIVERSE strict]))
{
// It's OK to have a hard error here since only built-in scripts run in strict mode.
OOJSReportError(context, @"Cannot set equipment status while in strict mode.");
return NO;
}
if (argc < 2) if (argc < 2)
{ {
OOJSReportBadArguments(context, @"Ship", @"setEquipmentStatus", argc, OOJS_ARGV, nil, @"equipment type and status"); OOJSReportBadArguments(context, @"Ship", @"setEquipmentStatus", argc, OOJS_ARGV, nil, @"equipment type and status");

View File

@ -198,7 +198,6 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context);
- (void) prunePreloadingPlanetMaterials; - (void) prunePreloadingPlanetMaterials;
#endif #endif
- (void) filterOutNonStrictEquipment;
- (BOOL) reinitAndShowDemo:(BOOL) showDemo strictChanged:(BOOL) strictChanged; - (BOOL) reinitAndShowDemo:(BOOL) showDemo strictChanged:(BOOL) strictChanged;
// Set shader effects level without logging or triggering a reset -- should only be used directly during startup. // Set shader effects level without logging or triggering a reset -- should only be used directly during startup.
@ -466,6 +465,8 @@ GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEVEL, DOC
} }
/* From 1.79, "strict mode" is "no OXPs mode" as a useful debug tool,
* nothing else */
- (BOOL) strict - (BOOL) strict
{ {
return strict; return strict;
@ -2314,7 +2315,7 @@ GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEVEL, DOC
GLfloat startAngle = 0; GLfloat startAngle = 0;
GLfloat aspectRatio = 1; GLfloat aspectRatio = 1;
if (!strict && forDocking) if (forDocking)
{ {
NSDictionary *info = [[PLAYER dockedStation] shipInfoDictionary]; NSDictionary *info = [[PLAYER dockedStation] shipInfoDictionary];
sides = [info oo_unsignedIntForKey:@"tunnel_corners" defaultValue:4]; sides = [info oo_unsignedIntForKey:@"tunnel_corners" defaultValue:4];
@ -2393,19 +2394,9 @@ GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEVEL, DOC
- (void) handleGameOver - (void) handleGameOver
{
// In unrestricted mode, reload last save game, if any. In strict mode, always restart as a fresh Jameson.
// NOTE: this is also called when loading a game fails, and when the js engine fails to reset properly.
if (![self strict] && [[self gameController] playerFileToLoad])
{ {
[[self gameController] loadPlayerIfRequired]; [[self gameController] loadPlayerIfRequired];
} }
else
{
[self reinitAndShowDemo:NO];
}
}
- (void) setupIntroFirstGo:(BOOL)justCobra - (void) setupIntroFirstGo:(BOOL)justCobra
@ -9493,33 +9484,11 @@ Entity *gOOJSPlayerIfStale = nil;
[equipmentData autorelease]; [equipmentData autorelease];
equipmentData = [[ResourceManager arrayFromFilesNamed:@"equipment.plist" inFolder:@"Config" andMerge:YES] retain]; equipmentData = [[ResourceManager arrayFromFilesNamed:@"equipment.plist" inFolder:@"Config" andMerge:YES] retain];
if (strict) [self filterOutNonStrictEquipment];
[OOEquipmentType loadEquipment]; [OOEquipmentType loadEquipment];
} }
- (void) filterOutNonStrictEquipment
{
NSMutableArray *filteredEq = [NSMutableArray arrayWithCapacity:[equipmentData count]];
NSArray *eqDef = nil;
foreach (eqDef, equipmentData)
{
BOOL compatible = NO;
if ([eqDef count] > EQUIPMENT_EXTRA_INFO_INDEX)
{
NSDictionary *extra = [eqDef oo_dictionaryAtIndex:EQUIPMENT_EXTRA_INFO_INDEX];
compatible = [extra oo_boolForKey:@"strict_mode_compatible" defaultValue:([extra objectForKey:@"strict_mode_only"] != nil)];
}
if (compatible) [filteredEq addObject:eqDef];
}
[equipmentData release];
equipmentData = [filteredEq copy];
}
- (void) verifyEntitySessionIDs - (void) verifyEntitySessionIDs
{ {
#ifndef NDEBUG #ifndef NDEBUG
@ -9625,7 +9594,6 @@ Entity *gOOJSPlayerIfStale = nil;
if(showDemo) if(showDemo)
{ {
[player setGuiToIntroFirstGo:NO]; [player setGuiToIntroFirstGo:NO];
if (strictChanged) [gui setText:(strict)? DESC(@"strict-play-enabled"):DESC(@"unrestricted-play-enabled") forRow:1 align:GUI_ALIGN_CENTER];
[player setStatus:STATUS_START_GAME]; [player setStatus:STATUS_START_GAME];
} }
else else