From 57b893d9f2ef3f190f8a9b2001dbac58ce065a22 Mon Sep 17 00:00:00 2001 From: Nikos Barkas Date: Fri, 14 Nov 2008 23:19:51 +0000 Subject: [PATCH] Fixed not working hasShipyard key for stations. git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1854 127b21dd-08f5-0310-b4b7-95ae10353056 --- src/Core/Entities/StationEntity.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Core/Entities/StationEntity.m b/src/Core/Entities/StationEntity.m index 3dc7d768..1a383e94 100644 --- a/src/Core/Entities/StationEntity.m +++ b/src/Core/Entities/StationEntity.m @@ -1986,7 +1986,8 @@ static NSDictionary* instructions(int station_id, Vector coords, float speed, fl if ([shipinfoDictionary objectForKey:@"hasShipyard"]) { PlayerEntity *player = [PlayerEntity sharedPlayer]; - id determinant = [shipinfoDictionary objectForKey:@"hasShipyard"]; + id determinant = [shipinfoDictionary objectForKey:@"hasShipyard"]; + if ([determinant isKindOfClass:[NSArray class]]) { NSArray *conditions = (NSArray *)determinant; @@ -1996,9 +1997,9 @@ static NSDictionary* instructions(int station_id, Vector coords, float speed, fl success &= [player scriptTestCondition:(NSString *)[conditions objectAtIndex:i]]; return success; } - if ([determinant isKindOfClass:[NSNumber class]]) + else { - float chance = [(NSNumber*)determinant floatValue]; + float chance = [shipinfoDictionary fuzzyBooleanForKey:@"hasShipyard"]; return (randf() < chance); } }