Fix for bounty and contract market credits display bugs. Fix for rounding of credits quantities. Added troubleshooting code to scanForNonThargoid. Suppress script.javaScript.context.create messages. Made property list extractors for strings auto-convert numbers.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1601 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
fc9ba4eb28
commit
ff322eafcb
@ -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 /* 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 = "<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 /* Oolite.app */,
|
||||
0865432206B8447D000CA0AB /* OoliteDev.app */,
|
||||
1A71E6F30BCE340C00CD5C13 /* libpng.a */,
|
||||
);
|
||||
name = Products;
|
||||
@ -2891,7 +2891,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 */ = {
|
||||
|
@ -369,7 +369,7 @@
|
||||
phonograms = "AEb=UW==sEH=IHt=IHl=EHt=st==AAn=lOW=nUW=T===nOW=AEl=lEY=hEY=JEH=zEY=sEH=bIY=sOW=UHs=EHz=AEr=mAE=IHn=dIY=rEY=EH==UXr=AEt=EHn=bEH=rAX=lAX=vEH=tIY=EHd=AAr=kw==AXn=tEY=IHz=rIY=AAn=";
|
||||
|
||||
// Currency format
|
||||
"@-credits" = "%@ ₢";
|
||||
"@-credits" = "%@ ₢";
|
||||
|
||||
// *** Misc. messages ***
|
||||
// Messages used when awarding bounties
|
||||
|
@ -254,6 +254,7 @@
|
||||
script.javaScript.exception = $scriptError;
|
||||
script.javaScript.warning = $scriptError;
|
||||
script.javaScript.badParameter = $scriptError;
|
||||
script.javaScript.context.create = no;
|
||||
|
||||
script.load = no;
|
||||
script.load.badName = $scriptError;
|
||||
|
@ -3276,7 +3276,7 @@ double scoopSoundPlayTime = 0.0;
|
||||
|
||||
if (score > 9)
|
||||
{
|
||||
NSString *bonusMS1 = [NSString stringWithFormat:DESC(@"bounty-@"), OOCredits(score/10)];
|
||||
NSString *bonusMS1 = [NSString stringWithFormat:DESC(@"bounty-@"), OOCredits(score)];
|
||||
NSString *bonusMS2 = [NSString stringWithFormat:DESC(@"total-@-credits"), OOCredits(credits)];
|
||||
|
||||
[UNIVERSE addDelayedMessage:bonusMS1 forCount:6 afterDelay:0.15];
|
||||
|
@ -535,8 +535,8 @@ static NSString * const kOOLogNoteShowShipyardModel = @"script.debug.note.showSh
|
||||
// remove passenger contracts that the player has already agreed to or done
|
||||
for (i = 0; i < [passenger_market count]; i++)
|
||||
{
|
||||
NSDictionary* info = (NSDictionary *)[passenger_market objectAtIndex:i];
|
||||
NSString* p_name = (NSString *)[info objectForKey:PASSENGER_KEY_NAME];
|
||||
NSDictionary* info = [passenger_market dictionaryAtIndex:i];
|
||||
NSString* p_name = [info stringForKey:PASSENGER_KEY_NAME];
|
||||
if ([passenger_record objectForKey:p_name])
|
||||
[passenger_market removeObjectAtIndex:i--];
|
||||
}
|
||||
@ -544,8 +544,8 @@ static NSString * const kOOLogNoteShowShipyardModel = @"script.debug.note.showSh
|
||||
// remove cargo contracts that the player has already agreed to or done
|
||||
for (i = 0; i < [contract_market count]; i++)
|
||||
{
|
||||
NSDictionary* info = (NSDictionary *)[contract_market objectAtIndex:i];
|
||||
NSString* cid = (NSString *)[info objectForKey:CONTRACT_KEY_ID];
|
||||
NSDictionary* info = [contract_market dictionaryAtIndex:i];
|
||||
NSString* cid = [info stringForKey:CONTRACT_KEY_ID];
|
||||
if ([contract_record objectForKey:cid])
|
||||
[contract_market removeObjectAtIndex:i--];
|
||||
}
|
||||
@ -601,16 +601,16 @@ static NSString * const kOOLogNoteShowShipyardModel = @"script.debug.note.showSh
|
||||
|
||||
for (i = 0; i < n_passengers; i++)
|
||||
{
|
||||
NSDictionary* passenger_info = (NSDictionary*)[passenger_market objectAtIndex:i];
|
||||
NSString *Name = [passenger_info objectForKey:PASSENGER_KEY_NAME];
|
||||
NSDictionary* passenger_info = [passenger_market dictionaryAtIndex:i];
|
||||
NSString *Name = [passenger_info stringForKey:PASSENGER_KEY_NAME];
|
||||
if([Name length] >26) Name =[[Name substringToIndex:25] stringByAppendingString:@"..."];
|
||||
int dest_eta = [(NSNumber*)[passenger_info objectForKey:PASSENGER_KEY_ARRIVAL_TIME] doubleValue] - ship_clock;
|
||||
int dest_eta = [passenger_info doubleForKey:PASSENGER_KEY_ARRIVAL_TIME] - ship_clock;
|
||||
[row_info removeAllObjects];
|
||||
[row_info addObject:[NSString stringWithFormat:@" %@ ",Name]];
|
||||
[row_info addObject:[NSString stringWithFormat:@" %@ ",[passenger_info objectForKey:PASSENGER_KEY_DESTINATION_NAME]]];
|
||||
[row_info addObject:[NSString stringWithFormat:@" %@ ",[passenger_info stringForKey:PASSENGER_KEY_DESTINATION_NAME]]];
|
||||
[row_info addObject:[NSString stringWithFormat:@" %@ ",[UNIVERSE shortTimeDescription:dest_eta]]];
|
||||
[row_info addObject:[NSString stringWithFormat:@" %@ ",[(NSNumber*)[passenger_info objectForKey:PASSENGER_KEY_PREMIUM] stringValue]]];
|
||||
[row_info addObject:[NSString stringWithFormat:@" %@ ",[(NSNumber*)[passenger_info objectForKey:PASSENGER_KEY_FEE] stringValue]]];
|
||||
[row_info addObject:[NSString stringWithFormat:@" %@ ",[passenger_info stringForKey:PASSENGER_KEY_PREMIUM]]];
|
||||
[row_info addObject:[NSString stringWithFormat:@" %@ ",[passenger_info stringForKey:PASSENGER_KEY_FEE]]];
|
||||
[gui setColor:[OOColor yellowColor] forRow:GUI_ROW_PASSENGERS_START + i];
|
||||
[gui setArray:[NSArray arrayWithArray:row_info] forRow:GUI_ROW_PASSENGERS_START + i];
|
||||
if (can_take_passengers)
|
||||
@ -647,8 +647,8 @@ static NSString * const kOOLogNoteShowShipyardModel = @"script.debug.note.showSh
|
||||
[row_info addObject:[NSString stringWithFormat:@" %@ ",[contract_info objectForKey:CONTRACT_KEY_CARGO_DESCRIPTION]]];
|
||||
[row_info addObject:[NSString stringWithFormat:@" %@ ",[contract_info objectForKey:CONTRACT_KEY_DESTINATION_NAME]]];
|
||||
[row_info addObject:[NSString stringWithFormat:@" %@ ",[UNIVERSE shortTimeDescription:dest_eta]]];
|
||||
[row_info addObject:[NSString stringWithFormat:@" %@ ",[(NSNumber*)[contract_info objectForKey:CONTRACT_KEY_PREMIUM] stringValue]]];
|
||||
[row_info addObject:[NSString stringWithFormat:@" %@ ",[(NSNumber*)[contract_info objectForKey:CONTRACT_KEY_FEE] stringValue]]];
|
||||
[row_info addObject:[NSString stringWithFormat:@" %@ ",[contract_info stringForKey:CONTRACT_KEY_PREMIUM]]];
|
||||
[row_info addObject:[NSString stringWithFormat:@" %@ ",[contract_info stringForKey:CONTRACT_KEY_FEE]]];
|
||||
[gui setColor:[OOColor yellowColor] forRow:GUI_ROW_CARGO_START + i];
|
||||
[gui setArray:[NSArray arrayWithArray:row_info] forRow:GUI_ROW_CARGO_START + i];
|
||||
if (not_possible)
|
||||
@ -679,7 +679,7 @@ static NSString * const kOOLogNoteShowShipyardModel = @"script.debug.note.showSh
|
||||
}
|
||||
if (([gui selectedRow] >= GUI_ROW_CARGO_START)&&([gui selectedRow] < (int)(GUI_ROW_CARGO_START + n_contracts)))
|
||||
{
|
||||
NSString* long_info = (NSString*)[(NSDictionary*)[contract_market objectAtIndex:[gui selectedRow] - GUI_ROW_CARGO_START] objectForKey:CONTRACT_KEY_LONG_DESCRIPTION];
|
||||
NSString* long_info = [[contract_market dictionaryAtIndex:[gui selectedRow] - GUI_ROW_CARGO_START] stringForKey:CONTRACT_KEY_LONG_DESCRIPTION];
|
||||
[gui addLongText:long_info startingAtRow:GUI_ROW_CONTRACT_INFO_START align:GUI_ALIGN_LEFT];
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ static NSString * const kOOLogEntityBehaviourChanged = @"entity.behaviour.change
|
||||
}
|
||||
|
||||
// Problem observed in testing -- Ahruman
|
||||
if (self != nil && !isfinite(maxFlightSpeed) && dict != nil)
|
||||
if (self != nil && !isfinite(maxFlightSpeed))
|
||||
{
|
||||
OOLog(@"ship.sanityCheck.failed", @"Ship %@ generated with infinite top speed!", self);
|
||||
maxFlightSpeed = 300;
|
||||
|
@ -942,7 +942,13 @@ WormholeEntity* whole;
|
||||
found_d2 = d2;
|
||||
}
|
||||
}
|
||||
if (found_target != NO_TARGET) [shipAI message:@"TARGET_FOUND"];
|
||||
|
||||
if (found_target != NO_TARGET)
|
||||
{
|
||||
|
||||
OOLog(@"ai.scanForNonThargoid.debug", @"scanForNonThargoid found target ship %@", [UNIVERSE entityForUniversalID:found_target]);
|
||||
[shipAI message:@"TARGET_FOUND"];
|
||||
}
|
||||
else [shipAI message:@"NOTHING_FOUND"];
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,7 @@ SOFTWARE.
|
||||
|
||||
|
||||
static NSSet *SetForObject(id object, NSSet *defaultValue);
|
||||
static NSString *StringForObject(id object, NSString *defaultValue);
|
||||
|
||||
|
||||
@implementation NSArray (OOExtractor)
|
||||
@ -180,7 +181,7 @@ static NSSet *SetForObject(id object, NSSet *defaultValue);
|
||||
|
||||
- (NSString *)stringAtIndex:(unsigned)index defaultValue:(NSString *)value
|
||||
{
|
||||
return [self objectOfClass:[NSString class] atIndex:index defaultValue:value];
|
||||
return StringForObject([self objectAtIndex:index], value);
|
||||
}
|
||||
|
||||
|
||||
@ -498,7 +499,7 @@ static NSSet *SetForObject(id object, NSSet *defaultValue);
|
||||
|
||||
- (NSString *)stringForKey:(id)key defaultValue:(NSString *)value
|
||||
{
|
||||
return [self objectOfClass:[NSString class] forKey:key defaultValue:value];
|
||||
return StringForObject([self objectForKey:key], value);
|
||||
}
|
||||
|
||||
|
||||
@ -816,7 +817,7 @@ static NSSet *SetForObject(id object, NSSet *defaultValue);
|
||||
|
||||
- (NSString *)stringForKey:(id)key defaultValue:(NSString *)value
|
||||
{
|
||||
return [self objectOfClass:[NSString class] forKey:key defaultValue:value];
|
||||
return StringForObject([self objectForKey:key], value);
|
||||
}
|
||||
|
||||
|
||||
@ -1404,3 +1405,12 @@ static NSSet *SetForObject(id object, NSSet *defaultValue)
|
||||
|
||||
else return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
static NSString *StringForObject(id object, NSString *defaultValue)
|
||||
{
|
||||
if ([object isKindOfClass:[NSString class]]) return object;
|
||||
else if ([object respondsToSelector:@selector(stringValue)]) return [object stringValue];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ void OOPrintLogHeader(void)
|
||||
#elif OOLITE_HAVE_APPKIT
|
||||
#define OS_TYPE_STRING "unknown AppKit system"
|
||||
#else
|
||||
#define "Unknown system"
|
||||
#define OS_TYPE_STRING "unknown system"
|
||||
#endif
|
||||
|
||||
#ifdef OO_DEBUG
|
||||
|
@ -511,7 +511,7 @@ NSString *OOStringFromDeciCredits(OOCreditsQuantity tenthsOfCredits, BOOL includ
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tenthsOfCredits >= 5) integerCredits++;
|
||||
if (tenths >= 5) integerCredits++;
|
||||
result = [NSString stringWithFormat:@"%llu", integerCredits];
|
||||
}
|
||||
|
||||
|
@ -6968,7 +6968,7 @@ double estimatedTimeForJourney(double distance, int hops)
|
||||
|
||||
long_description = [NSString stringWithFormat:
|
||||
DESC(@"contracts-@-the-contract-will-cost-you-@-and-pay-a-total-of-@"), long_description,
|
||||
OOCredits(premium), OOCredits(premium + fee)];
|
||||
OOIntCredits(premium), OOIntCredits(premium + fee)];
|
||||
|
||||
NSDictionary* contract_info_dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSString stringWithFormat:@"%06x-%06x", super_rand1, super_rand2 ],CONTRACT_KEY_ID,
|
||||
|
Loading…
x
Reference in New Issue
Block a user