Fix for ship.sanityCheck.failed messages.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1595 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2008-04-28 17:10:36 +00:00
parent 18ee20b861
commit 4933fb7796
2 changed files with 16 additions and 5 deletions

View File

@ -1014,7 +1014,7 @@
083325DC09DDBCDE00F5B8E4 /* OOColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOColor.m; sourceTree = "<group>"; };
083DB4D30A70E51E00B419B2 /* OOBrain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOBrain.h; sourceTree = "<group>"; };
083DB4D40A70E51E00B419B2 /* OOBrain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOBrain.m; sourceTree = "<group>"; };
0865432206B8447D000CA0AB /* OoliteDev.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OoliteDev.app; sourceTree = BUILT_PRODUCTS_DIR; };
0865432206B8447D000CA0AB /* Oolite.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Oolite.app; sourceTree = BUILT_PRODUCTS_DIR; };
0878FD2F086EF845004CB752 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
1A020E0A0D020AFB00C3F51E /* changedScriptHandlers.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = changedScriptHandlers.plist; sourceTree = "<group>"; };
@ -1676,7 +1676,7 @@
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
0865432206B8447D000CA0AB /* OoliteDev.app */,
0865432206B8447D000CA0AB /* Oolite.app */,
1A71E6F30BCE340C00CD5C13 /* libpng.a */,
);
name = Products;
@ -2891,7 +2891,7 @@
name = Oolite;
productInstallPath = "$(HOME)/Applications";
productName = Oolite;
productReference = 0865432206B8447D000CA0AB /* OoliteDev.app */;
productReference = 0865432206B8447D000CA0AB /* Oolite.app */;
productType = "com.apple.product-type.application";
};
1A71E6F20BCE340C00CD5C13 /* libpng-custom */ = {

View File

@ -102,6 +102,13 @@ static NSString * const kOOLogEntityBehaviourChanged = @"entity.behaviour.change
// Designated initializer
- (id) initWithDictionary:(NSDictionary *) dict
{
if (dict == nil && ![self isKindOfClass:[PlayerEntity class]])
{
// Is there any reason we should allow nil dictionary here? I think not. --Ahruman 2008-04-27
// Yes, the player ship uses -init. Any others? --Ahruman 2008-04-28
OOLog(@"ship.sanityCheck.nilDict", @"Ship created with nil dictionary!");
}
self = [super init];
isShip = YES;
@ -120,7 +127,7 @@ static NSString * const kOOLogEntityBehaviourChanged = @"entity.behaviour.change
}
// Problem observed in testing -- Ahruman
if (self != nil && !isfinite(maxFlightSpeed))
if (self != nil && !isfinite(maxFlightSpeed) && dict != nil)
{
OOLog(@"ship.sanityCheck.failed", @"Ship %@ generated with infinite top speed!", self);
maxFlightSpeed = 300;
@ -217,6 +224,10 @@ static NSString * const kOOLogEntityBehaviourChanged = @"entity.behaviour.change
isShip = YES;
// In order for default values to work and float values to not be junk,
// replace nil with empty dictionary. -- Ahruman 2008-04-28
if (shipDict == nil) shipDict = [NSDictionary dictionary];
#if OBSOLETE
// FIXME: like_ships should have been resolved before getting here. Replace with assert for no like_ship after 1.71 release. -- Ahruman 2008-04-19
// check if this is based upon a different ship
@ -1183,7 +1194,7 @@ ShipEntity* doOctreesCollide(ShipEntity* prime, ShipEntity* other)
if (!isfinite(maxFlightSpeed))
{
OOLog(@"ship.sanityCheck.failed", @"Ship %@ generated with infinite top speed!", self);
OOLog(@"ship.sanityCheck.failed", @"Ship %@ has infinite top speed!", self);
maxFlightSpeed = 300;
}