Added swathes of pointless and annoying type casts to placate buggy gnu-gcc ObjC front end. Also fixed JS player.alertEnergy and player.alertHostiles under GNUstep.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1603 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2008-05-01 01:02:57 +00:00
parent 1e3aec21f4
commit 6521c91b02
18 changed files with 47 additions and 46 deletions

View File

@ -229,7 +229,7 @@ OOINLINE BOOL StatusIsSendable(OOTCPClientConnectionStatus status)
parameters = [NSMutableDictionary dictionaryWithCapacity:3];
[parameters setObject:output forKey:kOOTCPMessage];
[parameters setObject:colorKey ? colorKey : @"general" forKey:kOOTCPColorKey];
[parameters setObject:colorKey ? colorKey : (NSString *)@"general" forKey:kOOTCPColorKey];
if (emphasisRange.length != 0)
{
range = [NSArray arrayWithObjects:
@ -364,7 +364,7 @@ noteChangedConfigrationValue:(in id)newValue
if (data == nil)
{
OOLog(@"debugTCP.conversionFailure", @"Could not convert dictionary to data for transmission to debug console: %@", errorDesc ? errorDesc : @"unknown error.");
OOLog(@"debugTCP.conversionFailure", @"Could not convert dictionary to data for transmission to debug console: %@", errorDesc ? errorDesc : (NSString *)@"unknown error.");
#if OOLITE_RELEASE_PLIST_ERROR_STRINGS
[errorDesc autorelease];
#endif

View File

@ -1070,7 +1070,7 @@ static NSString * const kOOLogEntityUpdateError = @"entity.linkedList.update.
ADD_FLAG_IF_SET(isSunlit);
ADD_FLAG_IF_SET(collisionTestFilter);
ADD_FLAG_IF_SET(throw_sparks);
flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : @"none";
flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : (NSString *)@"none";
OOLog(@"dumpState.entity", @"Flags: %@", flagsString);
}

View File

@ -30,7 +30,7 @@ MA 02110-1301, USA.
#import "OOOpenGLExtensionManager.h"
#import "OOGraphicsResetManager.h"
#if OOLITE_WINDOWS
#if !OOLITE_MAC_OS_X
#define NEED_STRLCPY
#endif
@ -1251,7 +1251,7 @@ static NSString * const kOOLogEntityTooManyFaces = @"entity.loadMesh.failed.to
#define ADD_FLAG_IF_SET(x) if (x) { [flags addObject:@#x]; }
ADD_FLAG_IF_SET(isSmoothShaded);
ADD_FLAG_IF_SET(materialsReady);
flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : @"none";
flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : (NSString *)@"none";
OOLog(@"dumpState.selfDrawingEntity", @"Flags: %@", flagsString);
}
#endif

View File

@ -4189,9 +4189,9 @@ double scoopSoundPlayTime = 0.0;
[gui setText:targetSystemName forRow:17];
[gui setText:[NSString stringWithFormat:DESC(@"long-range-chart-distance-f"), distance] forRow:18];
[gui setText:(distance <= (fuel/10.0f) ? [NSString stringWithFormat:DESC(@"long-range-chart-est-travel-time-f"), estimatedTravelTime] : @"") forRow:19];
[gui setText:(distance <= (fuel/10.0f) ? [NSString stringWithFormat:DESC(@"long-range-chart-est-travel-time-f"), estimatedTravelTime] : (id)@"") forRow:19];
NSString *displaySearchString = planetSearchString ? [planetSearchString capitalizedString] : @"";
NSString *displaySearchString = planetSearchString ? [planetSearchString capitalizedString] : (NSString *)@"";
[gui setText:[NSString stringWithFormat:DESC(@"long-range-chart-find-planet-@"), displaySearchString] forRow:16];
[gui setColor:[OOColor cyanColor] forRow:16];
@ -4238,7 +4238,7 @@ double scoopSoundPlayTime = 0.0;
[gui setText:targetSystemName forRow:19];
[gui setText:[NSString stringWithFormat:DESC(@"short-range-chart-distance-f"), distance] forRow:20];
[gui setText:(distance <= (fuel/10.0f) ? [NSString stringWithFormat:DESC(@"short-range-chart-est-travel-time-f"), estimatedTravelTime] : @"") forRow:21];
[gui setText:(distance <= (fuel/10.0f) ? [NSString stringWithFormat:DESC(@"short-range-chart-est-travel-time-f"), estimatedTravelTime] : (id)@"") forRow:21];
[gui setShowTextCursor:NO];
@ -5453,12 +5453,12 @@ static int last_outfitting_index;
OOCreditsQuantity price_per_unit = [marketDef unsignedIntAtIndex:MARKET_PRICE];
OOMassUnit unit = [marketDef unsignedIntAtIndex:MARKET_UNITS];
NSString* available = (available_units > 0) ? [NSString stringWithFormat:@"%d",available_units] : DESC(@"commodity-quantity-none");
NSString* price = [NSString stringWithFormat:@" %.1f ",0.1 * price_per_unit];
NSString* owned = (units_in_hold > 0) ? [NSString stringWithFormat:@"%d",units_in_hold] : DESC(@"commodity-quantity-none");
NSString* units = DisplayStringForMassUnit(unit);
NSString* units_available = [NSString stringWithFormat:@" %@ %@ ",available, units];
NSString* units_owned = [NSString stringWithFormat:@" %@ %@ ",owned, units];
NSString *available = (available_units > 0) ? (NSString *)[NSString stringWithFormat:@"%d",available_units] : DESC(@"commodity-quantity-none");
NSString *price = [NSString stringWithFormat:@" %.1f ",0.1 * price_per_unit];
NSString *owned = (units_in_hold > 0) ? (NSString *)[NSString stringWithFormat:@"%d",units_in_hold] : DESC(@"commodity-quantity-none");
NSString *units = DisplayStringForMassUnit(unit);
NSString *units_available = [NSString stringWithFormat:@" %@ %@ ",available, units];
NSString *units_owned = [NSString stringWithFormat:@" %@ %@ ",owned, units];
if (unit == UNITS_TONS)
current_cargo += units_in_hold;
@ -6436,7 +6436,7 @@ OOSound* burnersound;
ADD_FLAG_IF_SET(keyboardRollPitchOverride);
ADD_FLAG_IF_SET(keyboardYawOverride);
ADD_FLAG_IF_SET(waitingForStickCallback);
flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : @"none";
flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : (NSString *)@"none";
OOLog(@"dumpState.playerEntity", @"Flags: %@", flagsString);
}
#endif

View File

@ -590,11 +590,11 @@ static BOOL sRunningScript = NO;
{
NSString *result = [self performSelector:selector];
TraceLog(kOOLogTraceTestConditionValues, @"..... comparing \"%@\" (%@ from %@) to \"%@\" (%@) with operator %@",
result ? result : @"nil",
[result class] ? (NSString *)[result class] : @"nil",
result ? result : (NSString *)@"nil",
[result class] ? (id)[result class] : (id)@"nil",
NSStringFromSelector(selector),
valueString ? valueString: (comparator == COMPARISON_UNDEFINED ? @"undefined" : @"nil"),
[valueString class] ? (NSString *)[valueString class] : @"nil",
valueString ? valueString: (NSString *)(comparator == COMPARISON_UNDEFINED ? @"undefined" : @"nil"),
[valueString class] ? (id)[valueString class] : (id)@"nil",
ComparisonTypeToString(comparator));
switch (comparator)
@ -643,11 +643,11 @@ static BOOL sRunningScript = NO;
valueStrings = [valueString componentsSeparatedByString:@","];
TraceLog(kOOLogTraceTestConditionValues, @"..... comparing '%@' (%@ from %@) to '%@' (%@) with operator %@",
result ? (NSString *)result : @"nil",
[result class] ? (NSString *)[result class] : @"nil",
result ? (NSString *)result : (NSString *)@"nil",
[result class] ? (id)[result class] : (id)@"nil",
NSStringFromSelector(selector),
valueString ? valueString : @"nil",
[valueString class] ? (NSString *)[valueString class] : @"nil",
valueString ? valueString : (NSString *)@"nil",
[valueString class] ? (id)[valueString class] : (id)@"nil",
ComparisonTypeToString(comparator));
count = [valueStrings count];
@ -671,11 +671,11 @@ static BOOL sRunningScript = NO;
value = [NSNumber numberWithDouble:[valueString doubleValue]];
TraceLog(kOOLogTraceTestConditionValues, @"..... comparing \"%@\" (%@ from %@) to \"%@\" (%@) with operator %@",
result ? (NSString *)result : @"nil",
[result class] ? (NSString *)[result class] : @"nil",
result ? (id)result : (id)@"nil",
[result class] ? (id)[result class] : (id)@"nil",
NSStringFromSelector(selector),
value ? (NSString *)value : (comparator == COMPARISON_UNDEFINED ? @"undefined" : @"nil"),
[value class] ? (NSString *)[value class] : @"nil",
value ? (id)value : (id)(comparator == COMPARISON_UNDEFINED ? @"undefined" : @"nil"),
[value class] ? (id)[value class] : (id)@"nil",
ComparisonTypeToString(comparator));
switch (comparator)

View File

@ -7870,7 +7870,7 @@ static BOOL AuthorityPredicate(Entity *entity, void *parameter)
ADD_FLAG_IF_SET(cloaking_device_active);
ADD_FLAG_IF_SET(canFragment);
ADD_FLAG_IF_SET(proximity_alert);
flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : @"none";
flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : (NSString *)@"none";
OOLog(@"dumpState.shipEntity", @"Flags: %@", flagsString);
}
#endif
@ -7884,7 +7884,7 @@ static BOOL AuthorityPredicate(Entity *entity, void *parameter)
- (NSDictionary *)scriptInfo
{
return (scriptInfo != nil) ? scriptInfo : [NSDictionary dictionary];
return (scriptInfo != nil) ? scriptInfo : (NSDictionary *)[NSDictionary dictionary];
}

View File

@ -1886,7 +1886,7 @@ static NSDictionary* instructions(int station_id, Vector coords, float speed, fl
#define ADD_FLAG_IF_SET(x) if (x) { [flags addObject:@#x]; }
ADD_FLAG_IF_SET(no_docking_while_launching);
if ([self isRotatingStation]) { [flags addObject:@"rotatingStation"]; }
flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : @"none";
flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : (NSString *)@"none";
OOLog(@"dumpState.stationEntity", @"Flags: %@", flagsString);
}

View File

@ -89,7 +89,7 @@ static NSString *GetGLSLInfoLog(GLhandleARB shaderObject);
// Use cache to avoid creating duplicate shader programs -- saves on GPU resources and potentially state changes.
// FIXME: probably needs to respond to graphics resets.
cacheKey = [NSString stringWithFormat:@"vertex:%@\nfragment:%@\n----\n%@", vertexShaderName, fragmentShaderName, prefixString ?: @""];
cacheKey = [NSString stringWithFormat:@"vertex:%@\nfragment:%@\n----\n%@", vertexShaderName, fragmentShaderName, prefixString ?: (NSString *)@""];
result = [[sShaderCache objectForKey:cacheKey] pointerValue];
if (result == nil)

View File

@ -229,7 +229,7 @@ static BOOL sRectangleTextureAvailable;
options &= ~kOOTextureNoFNFMessage;
// Look for existing texture
key = [NSString stringWithFormat:@"%@%@%@:0x%.4X/%g/%g", directory ? directory : @"", directory ? @"/" : @"", name, options, anisotropy, lodBias];
key = [NSString stringWithFormat:@"%@%@%@:0x%.4X/%g/%g", directory ? directory : (NSString *)@"", directory ? @"/" : @"", name, options, anisotropy, lodBias];
result = (id)[[sInUseTextures objectForKey:key] pointerValue];
if (result == nil)
{

View File

@ -142,7 +142,7 @@ MA 02110-1301, USA.
- (void) appendLine:(NSString *)line
{
[self appendString:line ? [line stringByAppendingString:@"\n"] : @"\n"];
[self appendString:line ? [line stringByAppendingString:@"\n"] : (NSString *)@"\n"];
}

View File

@ -148,7 +148,7 @@ unsigned OOCPUCount(void);
#endif
#if OOLITE_ALTIVEC_DYNAMIC && !OOLITE_MAC_OS_X
#warning OOLITE_ALTIVEC is set, but Oolite doesn't know how to detect AltiVec on this platform. Either implement OOAltivecAvailable() or predefine OOLITE_ALTIVEC_ALWAYS to 1 if you know it will always be available.
#warning OOLITE_ALTIVEC is set, but Oolite does not know how to detect AltiVec on this platform. Either implement OOAltivecAvailable() or predefine OOLITE_ALTIVEC_ALWAYS to 1 if you know it will always be available.
#undef OOLITE_ALTIVEC_DYNAMIC
#undef OOLITE_ALTIVEC
#define OOLITE_ALTIVEC 0

View File

@ -116,7 +116,7 @@ void OOCPUInfoInit(void)
if (flag) sAltiVecAvailable = YES;
}
#else
#error OOLITE_ALTIVEC_DYNAMIC is (still) set, but Oolite doesn't know how to check for AltiVec on this platform. (The Mac version may work on other BSDs, at least; give it a shot.)
#error OOLITE_ALTIVEC_DYNAMIC is (still) set, but Oolite does not know how to check for AltiVec on this platform. (The Mac version may work on other BSDs, at least; give it a shot.)
#endif
#endif

View File

@ -126,7 +126,7 @@ OOINLINE double OOClamp_0_max_d(double value, double max) INLINE_CONST_FUNC;
}
#define OOFASTARITHMETIC_USED_PPC
#else
#warning Unknown compiler - don't know how to use PowerPC intrinsics. Using less efficient methods.
#warning Unknown compiler - not sure how to use PowerPC intrinsics. Using less efficient methods.
#define OO_PPC_fsel(test, a, b) (((test)>0)?(a):(b))
#define OO_PPC_fsels(test, a, b) OO_PPC_fsel(test, a, b)
#define OO_PPC_fres(val) (1.0f/(val))

View File

@ -457,7 +457,7 @@ shaderBindingTarget:(id<OOWeakReferenceSupport>)object
flags = [NSMutableArray array];
#define ADD_FLAG_IF_SET(x) if (x) { [flags addObject:@#x]; }
ADD_FLAG_IF_SET(isSmoothShaded);
flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : @"none";
flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : (NSString *)@"none";
OOLog(@"dumpState.mesh", @"Flags: %@", flagsString);
}
#endif

View File

@ -211,7 +211,7 @@ static NSMutableDictionary *string_cache;
+ (NSArray *)paths
{
return sUseAddOns ? [self pathsWithAddOns] : [NSArray arrayWithObject:[self builtInPath]];
return sUseAddOns ? [self pathsWithAddOns] : (NSArray *)[NSArray arrayWithObject:[self builtInPath]];
}
@ -351,7 +351,7 @@ static NSMutableDictionary *string_cache;
if (descriptionKey != nil)
{
if (sErrors == nil) sErrors = [[NSMutableArray alloc] init];
[sErrors addObject:[NSArray arrayWithObjects:descriptionKey, param1 ?: @"", param2 ?: @"", nil]];
[sErrors addObject:[NSArray arrayWithObjects:descriptionKey, param1 ?: (id)@"", param2 ?: (id)@"", nil]];
}
}
@ -543,7 +543,7 @@ static NSMutableDictionary *string_cache;
if (fileName == nil) return nil;
cacheKey = [NSString stringWithFormat:@"%@%@ merge:%@", (folderName != nil) ? [folderName stringByAppendingString:@"/"] : @"", fileName, mergeFiles ? @"yes" : @"no"];
cacheKey = [NSString stringWithFormat:@"%@%@ merge:%@", (folderName != nil) ? [folderName stringByAppendingString:@"/"] : (NSString *)@"", fileName, mergeFiles ? @"yes" : @"no"];
result = [cache objectForKey:cacheKey inCache:@"arrays"];
if (result != nil) return result;

View File

@ -190,7 +190,7 @@ static JSFunctionSpec sScriptMethods[] =
version = [[[self propertyNamed:@"version"] description] copy];
description = [[[self propertyNamed:@"description"] description] copy];
OOLog(@"script.javaScript.load.success", @"Loaded JavaScript OXP: %@ -- %@", [self displayName], description ? description : @"(no description)");
OOLog(@"script.javaScript.load.success", @"Loaded JavaScript OXP: %@ -- %@", [self displayName], description ? description : (NSString *)@"(no description)");
}
if (problem)

View File

@ -118,8 +118,9 @@ void OOSetJSWarningOrErrorStackSkip(unsigned skip); // Indicate that the direct
BOOL NumberFromArgumentList(JSContext *context, NSString *scriptClass, NSString *function, uintN argc, jsval *argv, double *outNumber, uintN *outConsumed);
OOINLINE jsval BOOLToJSVal(BOOL b) INLINE_CONST_FUNC;
OOINLINE jsval BOOLToJSVal(BOOL b)
// Typed as int rather than BOOL to work with more general expressions such as bitfield tests.
OOINLINE jsval BOOLToJSVal(int b) INLINE_CONST_FUNC;
OOINLINE jsval BOOLToJSVal(int b)
{
return BOOLEAN_TO_JSVAL(b != NO);
}

View File

@ -571,7 +571,7 @@ static NSComparisonResult comparePrice(NSDictionary *dict1, NSDictionary *dict2,
OOLogIndent();
for (i = 0; i < show_count; i++)
{
ShipEntity* se = (sortedEntities[i]->isShip)? (ShipEntity*)sortedEntities[i]: nil;
ShipEntity* se = (sortedEntities[i]->isShip)? (id)sortedEntities[i]: nil;
OOLog(@"universe.objectDump", @"-> Ent:%d\t\t%@ mass %.2f %@", i, sortedEntities[i], [sortedEntities[i] mass], [se getAI]);
}
OOLogOutdent();
@ -7238,7 +7238,7 @@ double estimatedTimeForJourney(double distance, int hops)
if (passenger_berths)
{
NSString* npb = (passenger_berths > 1)? [NSString stringWithFormat:@"%d ", passenger_berths] : @"";
NSString* npb = (passenger_berths > 1)? [NSString stringWithFormat:@"%d ", passenger_berths] : (id)@"";
NSString* ppb = (passenger_berths > 1)? DESC(@"passenger-berth-plural") : DESC(@"passenger-berth-single");
[description appendFormat:@"Extra %@%@ (%@)", npb, ppb, passengerBerthLongDesc];
[short_description appendFormat:@"Extra %@%@.", npb, ppb];
@ -7293,7 +7293,7 @@ double estimatedTimeForJourney(double distance, int hops)
}
NSMutableArray *resultArray = [[[resultDictionary allValues] mutableCopy] autorelease];
[resultArray sortUsingFunction:compareName context:nil];
[resultArray sortUsingFunction:(int(*)(id, id, void *))compareName context:NULL];
// remove identically priced ships of the same name
i = 1;