diff --git a/Oolite.xcodeproj/project.pbxproj b/Oolite.xcodeproj/project.pbxproj index 6ce49364..041d514b 100644 --- a/Oolite.xcodeproj/project.pbxproj +++ b/Oolite.xcodeproj/project.pbxproj @@ -974,7 +974,7 @@ 083325DC09DDBCDE00F5B8E4 /* OOColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOColor.m; sourceTree = ""; }; 083DB4D30A70E51E00B419B2 /* OOBrain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOBrain.h; sourceTree = ""; }; 083DB4D40A70E51E00B419B2 /* OOBrain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOBrain.m; sourceTree = ""; }; - 0865432206B8447D000CA0AB /* Oolite.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Oolite.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 0865432206B8447D000CA0AB /* OoliteDev.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OoliteDev.app; sourceTree = BUILT_PRODUCTS_DIR; }; 0878FD2F086EF845004CB752 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 1A020E0A0D020AFB00C3F51E /* changedScriptHandlers.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = changedScriptHandlers.plist; sourceTree = ""; }; @@ -1605,7 +1605,7 @@ 19C28FACFE9D520D11CA2CBB /* Products */ = { isa = PBXGroup; children = ( - 0865432206B8447D000CA0AB /* Oolite.app */, + 0865432206B8447D000CA0AB /* OoliteDev.app */, 1A71E6F30BCE340C00CD5C13 /* libpng.a */, ); name = Products; @@ -2756,7 +2756,7 @@ name = Oolite; productInstallPath = "$(HOME)/Applications"; productName = Oolite; - productReference = 0865432206B8447D000CA0AB /* Oolite.app */; + productReference = 0865432206B8447D000CA0AB /* OoliteDev.app */; productType = "com.apple.product-type.application"; }; 1A71E6F20BCE340C00CD5C13 /* libpng-custom */ = { diff --git a/src/Core/Entities/PlayerEntity.m b/src/Core/Entities/PlayerEntity.m index a8e3c144..06bc4702 100644 --- a/src/Core/Entities/PlayerEntity.m +++ b/src/Core/Entities/PlayerEntity.m @@ -500,6 +500,20 @@ static PlayerEntity *sSharedPlayer = nil; if ([dict objectForKey:@"extra_equipment"]) { [extra_equipment addEntriesFromDictionary:(NSDictionary *)[dict objectForKey:@"extra_equipment"]]; + /* Bug workaround: extra_equipment should never contain EQ_TRUMBLE, + which is basically a magic flag passed to awardEquipment: to infect + the player. However, prior to Oolite 1.70.1, if the player had a + trumble infection and awardEquipment:EQ_TRUMBLE was called, an + EQ_TRUMBLE would be added to the equipment list. Subsequent calls + to awardEquipment:EQ_TRUMBLE would exit early because there was an + EQ_TRUMBLE in the equipment list. as a result, it would no longer + be possible to infect the player after the current infection ended. + + The bug is fixed in 1.70.1. The following line is to fix old saved + games which had been "corrupted" by the bug. + -- Ahruman 2007-12-04 + */ + [extra_equipment removeObjectForKey:@"EQ_TRUMBLE"]; } // bools (mostly deprecated by use of the extra_equipment dictionary, keep for compatibility) @@ -5712,9 +5726,18 @@ static int last_outfitting_index; [extra_equipment removeObjectForKey:damaged_eq_key]; // deal with trumbles.. - if ([eq_key isEqual:@"EQ_TRUMBLE"] && (trumbleCount < 1)) + if ([eq_key isEqual:@"EQ_TRUMBLE"]) { - [self addTrumble:trumble[ranrot_rand() % PLAYER_MAX_TRUMBLES]]; // first one! + /* Bug fix: must return here if eq_key == @"EQ_TRUMBLE", even if + trumbleCount >= 1. Otherwise, the player becomes immune to + trumbles. See comment in -setCommanderDataFromDictionary: for more + details. + -- Ahruman 2008-12-04 + */ + if (trumbleCount < 1) + { + [self addTrumble:trumble[ranrot_rand() % PLAYER_MAX_TRUMBLES]]; // first one! + } return; } diff --git a/src/Core/Entities/PlayerEntityLegacyScriptEngine.m b/src/Core/Entities/PlayerEntityLegacyScriptEngine.m index b5979f8c..ac665bc1 100644 --- a/src/Core/Entities/PlayerEntityLegacyScriptEngine.m +++ b/src/Core/Entities/PlayerEntityLegacyScriptEngine.m @@ -1276,8 +1276,8 @@ static int scriptRandomSeed = -1; // ensure proper random function return; } - roleString = (NSString *)[tokens objectAtIndex:0]; - numberString = (NSString *)[tokens objectAtIndex:1]; + roleString = [tokens objectAtIndex:0]; + numberString = [tokens objectAtIndex:1]; int number = [numberString intValue]; if (number < 0) diff --git a/src/Core/Entities/PlayerEntityLoadSave.m b/src/Core/Entities/PlayerEntityLoadSave.m index 4d5a0251..353f1ae0 100644 --- a/src/Core/Entities/PlayerEntityLoadSave.m +++ b/src/Core/Entities/PlayerEntityLoadSave.m @@ -347,12 +347,12 @@ - (BOOL) loadPlayerFromFile:(NSString *)fileToOpen { /* TODO: it would probably be better to load by creating a new - PlayerEntity, verifying that's OK, then replacing the global player. - - Actually, it'd be better to separate PlayerEntity into OOPlayer and - OOPlayerShipEntity. And then move most of OOPlayerShipEntity into - ShipEntity, and make NPC ships behave more like player ships. - -- Ahruman + PlayerEntity, verifying that's OK, then replacing the global player. + + Actually, it'd be better to separate PlayerEntity into OOPlayer and + OOPlayerShipEntity. And then move most of OOPlayerShipEntity into + ShipEntity, and make NPC ships behave more like player ships. + -- Ahruman */ BOOL loadedOK = YES;