Made JS player.orientation work properly. Fixed some extra-niggly warnings. Made various JS system properties return placeholder values in interstellar space. Added -[Universe inInterstellarSpace] method, and made -[Universe currentSystemData] return placeholder values in interstellar space. Two new localizable strings.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1661 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2008-05-29 19:12:31 +00:00
parent 08ebc6dd29
commit a11ce38786
17 changed files with 130 additions and 52 deletions

View File

@ -47,6 +47,8 @@
1A1616620D7DCFDC0094AE5B /* OOFilteringEnumerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1616600D7DCFDC0094AE5B /* OOFilteringEnumerator.h */; };
1A1616630D7DCFDC0094AE5B /* OOFilteringEnumerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A1616610D7DCFDC0094AE5B /* OOFilteringEnumerator.m */; };
1A1D212E0D2BD4C100F4DEC2 /* bsd_string.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1D212D0D2BD4C100F4DEC2 /* bsd_string.h */; };
1A21149B0DEA980800444CEB /* oolite-ball-turret.dat in Copy Models */ = {isa = PBXBuildFile; fileRef = 1A21149A0DEA980800444CEB /* oolite-ball-turret.dat */; };
1A21149E0DEA98D100444CEB /* oolite-ball-turret.png in Copy Textures */ = {isa = PBXBuildFile; fileRef = 1A21149D0DEA98D100444CEB /* oolite-ball-turret.png */; };
1A2315520B9C778400EF0852 /* solar.png in Copy Images */ = {isa = PBXBuildFile; fileRef = 1A23154E0B9C778400EF0852 /* solar.png */; };
1A2315530B9C778400EF0852 /* splash.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A23154F0B9C778400EF0852 /* splash.png */; };
1A2315540B9C778400EF0852 /* splashback.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A2315500B9C778400EF0852 /* splashback.png */; };
@ -769,6 +771,7 @@
dstPath = Textures;
dstSubfolderSpec = 7;
files = (
1A21149E0DEA98D100444CEB /* oolite-ball-turret.png in Copy Textures */,
1AE834CA0D9598C10097CB8A /* oolite-barrel-specular.png in Copy Textures */,
1AC544FA0D4D217900C90E5B /* oolite-font.png in Copy Textures */,
1A03659B0D7CA0EE00B5F46F /* oolite-nebula-4.png in Copy Textures */,
@ -845,6 +848,7 @@
dstPath = Models;
dstSubfolderSpec = 7;
files = (
1A21149B0DEA980800444CEB /* oolite-ball-turret.dat in Copy Models */,
1A1502F60C1201C30032F3E8 /* oolite-unknown-ship.dat in Copy Models */,
1A2318E50B9D02AA00EF0852 /* adder_redux.dat in Copy Models */,
1A2318E60B9D02AA00EF0852 /* alloy.dat in Copy Models */,
@ -1043,6 +1047,8 @@
1A1616600D7DCFDC0094AE5B /* OOFilteringEnumerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOFilteringEnumerator.h; sourceTree = "<group>"; };
1A1616610D7DCFDC0094AE5B /* OOFilteringEnumerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOFilteringEnumerator.m; sourceTree = "<group>"; };
1A1D212D0D2BD4C100F4DEC2 /* bsd_string.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bsd_string.h; path = src/BSDCompat/bsd_string.h; sourceTree = SOURCE_ROOT; };
1A21149A0DEA980800444CEB /* oolite-ball-turret.dat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "oolite-ball-turret.dat"; sourceTree = "<group>"; };
1A21149D0DEA98D100444CEB /* oolite-ball-turret.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "oolite-ball-turret.png"; sourceTree = "<group>"; };
1A23154E0B9C778400EF0852 /* solar.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = solar.png; sourceTree = "<group>"; };
1A23154F0B9C778400EF0852 /* splash.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = splash.png; sourceTree = "<group>"; };
1A2315500B9C778400EF0852 /* splashback.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = splashback.png; sourceTree = "<group>"; };
@ -1854,6 +1860,7 @@
1A2318420B9D026D00EF0852 /* moray_redux1.png */,
1A2318430B9D026D00EF0852 /* MorayMED_bottom.png */,
1A2318440B9D026D00EF0852 /* MorayMED_top.png */,
1A21149D0DEA98D100444CEB /* oolite-ball-turret.png */,
1AC544F90D4D217900C90E5B /* oolite-font.png */,
1A3591690C1C375400E52220 /* oolite-nebula-1.png */,
1A35916C0C1C375400E52220 /* oolite-nebula-2.png */,
@ -1927,6 +1934,7 @@
1A2318C80B9D02A900EF0852 /* new-icos.dat */,
1A2318C90B9D02A900EF0852 /* new-rock.dat */,
1A2318CA0B9D02A900EF0852 /* new_coriolis.dat */,
1A21149A0DEA980800444CEB /* oolite-ball-turret.dat */,
1A1502F50C1201C30032F3E8 /* oolite-unknown-ship.dat */,
1A2318CB0B9D02A900EF0852 /* python_redux.dat */,
1A2318CC0B9D02A900EF0852 /* python_redux1.dat */,

View File

@ -367,6 +367,8 @@
digrams-apostrophe = "";
// this string represents the 4 character phonemes associated with each digram.
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=";
"interstellar-space" = "Interstellar space";
"not-applicable" = "N/A";
// Currency format
"@-credits" = "%@ ₢";

View File

@ -2680,4 +2680,19 @@
model = "wreck5.dat";
roles = "wreckage oolite-more-wreckage5";
};
"ballturret" =
{
/* Standard turret.
Not used by Oolite directly, but provided as a resource for OXPs
starting with Oolite 1.72.
*/
ai_type = "nullAI.plist";
laser_color = magentaColor;
model = "oolite-ball-turret.dat";
name = "Ball Turret";
roles = ballturret;
setup_actions = ( initialiseTurret );
thrust = 1;
weapon_energy = 25;
};
}

View File

@ -43,6 +43,7 @@ static NSString * kOOLogKeyDown = @"input.keyMapping.keyPress.keyDown";
@interface MyOpenGLView(Internal)
- (int) translateKeyCode: (int) input;
- (void)performLateSetup;
@end

View File

@ -114,6 +114,7 @@ static NSString *GetAppName(void);
// Internal
- (BOOL)startLogging;
- (void)loggerThread;
- (void)flushLog;
@end

View File

@ -208,9 +208,10 @@ typedef struct
- (GLfloat) mass;
- (void) setOrientation:(Quaternion) quat;
- (Quaternion) orientation;
- (void) setOrientation:(Quaternion) quat;
- (Quaternion) normalOrientation; // Historical wart: orientation.w is reversed for player; -normalOrientation corrects this.
- (void) setNormalOrientation:(Quaternion) quat;
- (void) orientationChanged;
- (void) setVelocity:(Vector)vel;

View File

@ -609,6 +609,12 @@ static NSString * const kOOLogEntityUpdateError = @"entity.linkedList.update.
}
- (void) setNormalOrientation:(Quaternion) quat
{
[self setOrientation:quat];
}
- (void) orientationChanged
{
quaternion_normalize(&orientation);

View File

@ -1945,6 +1945,12 @@ double scoopSoundPlayTime = 0.0;
}
- (void) setNormalOrientation:(Quaternion) quat
{
[self setOrientation:make_quaternion(-quat.w, quat.x, quat.y, quat.z)];
}
- (void) moveForward:(double) amount
{
distanceTravelled += amount;
@ -5760,9 +5766,10 @@ OOSound* burnersound;
- (void) getFined
{
if (legalStatus == 0)
return; // nothing to pay for
int local_gov = [[UNIVERSE currentSystemData] intForKey:KEY_GOVERNMENT];
if (legalStatus == 0) return; // nothing to pay for
OOGovernmentID local_gov = [[UNIVERSE currentSystemData] intForKey:KEY_GOVERNMENT];
if ([UNIVERSE inInterstellarSpace]) local_gov = 1; // equivalent to Feudal. I'm assuming any station in interstellar space is military. -- Ahruman 2008-05-29
OOCreditsQuantity fine = 500 + ((local_gov < 2)||(local_gov > 5))? 500:0;
fine *= legalStatus;
if (fine > credits)
@ -6311,8 +6318,10 @@ OOSound* burnersound;
- (void) setGalacticHyperspaceBehaviour:(OOGalacticHyperspaceBehaviour)inBehaviour
{
if (!EXPECT_NOT(inBehaviour <= GALACTIC_HYPERSPACE_BEHAVIOUR_UNKNOWN || inBehaviour > GALACTIC_HYPERSPACE_MAX))
if (GALACTIC_HYPERSPACE_BEHAVIOUR_UNKNOWN < inBehaviour && inBehaviour <= GALACTIC_HYPERSPACE_MAX)
{
galacticHyperspaceBehaviour = inBehaviour;
}
}

View File

@ -51,15 +51,15 @@ static NSString * const kOOLogNoteShowShipyardModel = @"script.debug.note.showSh
@implementation PlayerEntity (Contracts)
- (NSString*) processEscapePods // removes pods from cargo bay and treats categories of characters carried
- (NSString *) processEscapePods // removes pods from cargo bay and treats categories of characters carried
{
if ([UNIVERSE strict])
return [NSString string]; // return a blank string
if ([UNIVERSE strict]) return [NSString string]; // return a blank string
unsigned i;
NSMutableString *result = [NSMutableString string];
NSMutableArray *rescuees = [NSMutableArray array];
int government = [[[UNIVERSE currentSystemData] objectForKey:KEY_GOVERNMENT] intValue];
OOGovernmentID government = [[[UNIVERSE currentSystemData] objectForKey:KEY_GOVERNMENT] intValue];
if ([UNIVERSE inInterstellarSpace]) government = 1; // equivalent to Feudal. I'm assuming any station in interstellar space is military. -- Ahruman 2008-05-29
// step through the cargo removing crew from any escape pods
// No enumerator because we're mutating the array -- Ahruman

View File

@ -888,9 +888,12 @@ static NSTimeInterval time_last_frame;
// there's a slight chance you'll be fined for your past offences when autodocking
int fine_chance = ranrot_rand() & 0x03ff; // 0..1023
int government = 1 + [[UNIVERSE currentSystemData] intForKey:KEY_GOVERNMENT]; // 1..8
if ([UNIVERSE inInterstellarSpace]) government = 2; // equivalent to Feudal. I'm assuming any station in interstellar space is military. -- Ahruman 2008-05-29
fine_chance /= government;
if (fine_chance < legalStatus)
{
[self markForFines];
}
}
ship_clock_adjust = 1200.0; // 20 minutes penalty to enter dock
ident_engaged = NO;

View File

@ -301,6 +301,8 @@ MA 02110-1301, USA.
- (void) setShipScript:(NSString *) script_name;
- (OOScript *)shipScript;
- (void) interpretAIMessage:(NSString *)message;
#ifdef OO_BRAIN_AI
- (OOBrain *)brain;
- (void)setBrain:(OOBrain*) aBrain;

View File

@ -813,13 +813,13 @@ static OOCacheNode *TreeCheckIntegrity(OOCacheImpl *cache, OOCacheNode *node, OO
if (OK && node->key == nil)
{
OOLog(kOOLogCacheIntegrityCheck, @"Integrity check (%@ for \"%@\"): node %@ has nil key; deleting subtree.", context, cache->name, CacheNodeGetDescription(node));
OOLog(kOOLogCacheIntegrityCheck, @"Integrity check (%@ for \"%@\"): node \"%@\" has nil key; deleting subtree.", context, cache->name, CacheNodeGetDescription(node));
OK = NO;
}
if (OK && node->value == nil)
{
OOLog(kOOLogCacheIntegrityCheck, @"Integrity check (%@ for \"%@\"): node %@ has nil value, deleting.", context, cache->name, CacheNodeGetDescription(node));
OOLog(kOOLogCacheIntegrityCheck, @"Integrity check (%@ for \"%@\"): node \"%@\" has nil value, deleting.", context, cache->name, CacheNodeGetDescription(node));
OK = NO;
}
if (OK && node->leftChild != NULL)
@ -842,7 +842,7 @@ static OOCacheNode *TreeCheckIntegrity(OOCacheImpl *cache, OOCacheNode *node, OO
order = [node->key compare:node->rightChild->key];
if (order != NSOrderedAscending)
{
OOLog(kOOLogCacheIntegrityCheck, @"Integrity check (%@ for \"%@\"): node %@'s right child %@ is not correctly ordered. Deleting subtree.", context, cache->name, CacheNodeGetDescription(node), CacheNodeGetDescription(node->rightChild));
OOLog(kOOLogCacheIntegrityCheck, @"Integrity check (%@ for \"%@\"): node \"%@\"'s right child \"%@\" is not correctly ordered. Deleting subtree.", context, cache->name, CacheNodeGetDescription(node), CacheNodeGetDescription(node->rightChild));
CacheNodeFree(cache, node->rightChild);
node->rightChild = nil;
cache->count = kCountUnknown;
@ -920,7 +920,7 @@ static void AgeListCheckIntegrity(OOCacheImpl *cache, NSString *context)
if (next->younger != node)
{
OOLog(kOOLogCacheIntegrityCheck, @"Integrity check (%@ for \"%@\"): node %@ has invalid older link (should be %@, is %@); repairing.", context, cache->name, CacheNodeGetDescription(next), CacheNodeGetDescription(node), CacheNodeGetDescription(next->older));
OOLog(kOOLogCacheIntegrityCheck, @"Integrity check (%@ for \"%@\"): node \"%@\" has invalid older link (should be \"%@\", is \"%@\"); repairing.", context, cache->name, CacheNodeGetDescription(next), CacheNodeGetDescription(node), CacheNodeGetDescription(next->older));
next->older = node;
}
node = next;
@ -940,7 +940,7 @@ static void AgeListCheckIntegrity(OOCacheImpl *cache, NSString *context)
if (node != cache->oldest)
{
OOLog(kOOLogCacheIntegrityCheck, @"Integrity check (%@ for \"%@\"): oldest pointer in cache is wrong (should be %@, is %@); repairing.", context, cache->name, CacheNodeGetDescription(node), CacheNodeGetDescription(cache->oldest));
OOLog(kOOLogCacheIntegrityCheck, @"Integrity check (%@ for \"%@\"): oldest pointer in cache is wrong (should be \"%@\", is \"%@\"); repairing.", context, cache->name, CacheNodeGetDescription(node), CacheNodeGetDescription(cache->oldest));
cache->oldest = node;
}
}

View File

@ -207,6 +207,13 @@ static BOOL IsFailureAlreadyReportedError(NSError *error);
@end
@interface NSString (OOPListSchemaVerifierHelpers)
- (BOOL)ooPListVerifierHasSubString:(NSString *)string;
@end
#define VERIFY_PROTO(T) static NSError *Verify_##T(OOPListSchemaVerifier *verifier, id value, NSDictionary *params, id rootPList, NSString *name, BackLinkChain keyPath, BOOL tentative, BOOL *outStop)
VERIFY_PROTO(String);
VERIFY_PROTO(Array) GCC_ATTR((noinline)); // Inlining suppressed to avoid "variable may be clobbered" warning when building for Mac OS X/x86.

View File

@ -239,11 +239,11 @@ static JSBool EntityGetProperty(JSContext *context, JSObject *this, jsval name,
break;
case kEntity_orientation:
OK = QuaternionToJSValue(context, [entity orientation], outValue);
OK = QuaternionToJSValue(context, [entity normalOrientation], outValue);
break;
case kEntity_heading:
OK = VectorToJSValue(context, vector_forward_from_quaternion([entity orientation]), outValue);
OK = VectorToJSValue(context, vector_forward_from_quaternion([entity normalOrientation]), outValue);
break;
case kEntity_status:
@ -381,7 +381,7 @@ static JSBool EntitySetOrientation(JSContext *context, JSObject *this, uintN arg
if (!JSEntityGetEntity(context, this, &thisEnt)) return YES; // stale reference, no-op.
if (EXPECT_NOT(!QuaternionFromArgumentList(context, @"Entity", @"setOrientation", argc, argv, &quaternion, NULL))) return NO;
[thisEnt setOrientation:quaternion];
[thisEnt setNormalOrientation:quaternion];
return YES;
}

View File

@ -44,9 +44,6 @@
static JSObject *sSystemPrototype;
static Random_Seed sCurrentSystem;
static NSDictionary *sPlanetInfo;
// Support functions for entity search methods.
static BOOL GetRelativeToAndRange(JSContext *context, uintN *ioArgc, jsval **ioArgv, Entity **outRelativeTo, double *outRange) NONNULL_FUNC;
@ -198,16 +195,12 @@ static JSBool SystemGetProperty(JSContext *context, JSObject *this, jsval name,
{
id result = nil;
PlayerEntity *player = nil;
NSDictionary *systemData = nil;
if (!JSVAL_IS_INT(name)) return YES;
player = OOPlayerForScripting();
if (!equal_seeds(sCurrentSystem, player->system_seed))
{
sCurrentSystem = player->system_seed;
}
[sPlanetInfo release];
sPlanetInfo = [[UNIVERSE generateSystemData:sCurrentSystem] retain];
systemData = [UNIVERSE currentSystemData];
switch (JSVAL_TO_INT(name))
{
@ -216,24 +209,26 @@ static JSBool SystemGetProperty(JSContext *context, JSObject *this, jsval name,
break;
case kSystem_name:
if ([UNIVERSE sun] != nil)
/*if ([UNIVERSE sun] != nil)
{
result = [sPlanetInfo objectForKey:KEY_NAME];
result = [systemData objectForKey:KEY_NAME];
if (result == nil) result = [NSNull null];
}
else
{
result = @"Interstellar space";
}
}*/
result = [systemData objectForKey:KEY_NAME];
if (result == nil) result = [NSNull null];
break;
case kSystem_description:
result = [sPlanetInfo objectForKey:KEY_DESCRIPTION];
result = [systemData objectForKey:KEY_DESCRIPTION];
if (result == nil) result = [NSNull null];
break;
case kSystem_inhabitantsDescription:
result = [sPlanetInfo objectForKey:KEY_INHABITANTS];
result = [systemData objectForKey:KEY_INHABITANTS];
if (result == nil) result = [NSNull null];
break;
@ -246,37 +241,39 @@ static JSBool SystemGetProperty(JSContext *context, JSObject *this, jsval name,
break;
case kSystem_government:
*outValue = INT_TO_JSVAL([sPlanetInfo intForKey:KEY_GOVERNMENT]);
*outValue = INT_TO_JSVAL([systemData intForKey:KEY_GOVERNMENT]);
break;
case kSystem_governmentDescription:
result = GovernmentToString([sPlanetInfo intForKey:KEY_GOVERNMENT]);
result = GovernmentToString([systemData intForKey:KEY_GOVERNMENT]);
if (result == nil && [UNIVERSE inInterstellarSpace]) result = DESC(@"not-applicable");
if (result == nil) result = [NSNull null];
break;
case kSystem_economy:
*outValue = INT_TO_JSVAL([sPlanetInfo intForKey:KEY_ECONOMY]);
*outValue = INT_TO_JSVAL([systemData intForKey:KEY_ECONOMY]);
break;
case kSystem_economyDescription:
result = EconomyToString([sPlanetInfo intForKey:KEY_ECONOMY]);
result = EconomyToString([systemData intForKey:KEY_ECONOMY]);
if (result == nil && [UNIVERSE inInterstellarSpace]) result = DESC(@"not-applicable");
if (result == nil) result = [NSNull null];
break;
case kSystem_techLevel:
*outValue = INT_TO_JSVAL([sPlanetInfo intForKey:KEY_TECHLEVEL]);
*outValue = INT_TO_JSVAL([systemData intForKey:KEY_TECHLEVEL]);
break;
case kSystem_population:
*outValue = INT_TO_JSVAL([sPlanetInfo intForKey:KEY_POPULATION]);
*outValue = INT_TO_JSVAL([systemData intForKey:KEY_POPULATION]);
break;
case kSystem_productivity:
*outValue = INT_TO_JSVAL([sPlanetInfo intForKey:KEY_PRODUCTIVITY]);
*outValue = INT_TO_JSVAL([systemData intForKey:KEY_PRODUCTIVITY]);
break;
case kSystem_isInterstellarSpace:
*outValue = BOOLToJSVal([UNIVERSE sun] == nil);
*outValue = BOOLToJSVal([UNIVERSE inInterstellarSpace]);
break;
case kSystem_mainStation:
@ -325,12 +322,6 @@ static JSBool SystemSetProperty(JSContext *context, JSObject *this, jsval name,
if (!JSVAL_IS_INT(name)) return YES;
player = OOPlayerForScripting();
if (!equal_seeds(sCurrentSystem, player->system_seed))
{
sCurrentSystem = player->system_seed;
}
[sPlanetInfo release];
sPlanetInfo = [[UNIVERSE generateSystemData:sCurrentSystem] retain];
galaxy = [player currentGalaxyID];
system = [player currentSystemID];
@ -416,9 +407,6 @@ static JSBool SystemSetProperty(JSContext *context, JSObject *this, jsval name,
OOReportJSBadPropertySelector(context, @"System", JSVAL_TO_INT(name));
}
// Hmm, what are these for? Who put them here? -- Ahruman 20080523
[UNIVERSE generateSystemData:kNilRandomSeed];
[UNIVERSE generateSystemData:sCurrentSystem];
return OK;
}

View File

@ -463,7 +463,9 @@ enum
- (NSString *) keyForPlanetOverridesForSystemSeed:(Random_Seed) s_seed inGalaxySeed:(Random_Seed) g_seed;
- (NSString *) keyForInterstellarOverridesForSystemSeeds:(Random_Seed) s_seed1 :(Random_Seed) s_seed2 inGalaxySeed:(Random_Seed) g_seed;
- (NSDictionary *) generateSystemData:(Random_Seed) system_seed;
- (NSDictionary *) currentSystemData;
- (NSDictionary *) currentSystemData; // Same as generateSystemData:systemSeed unless in interstellar space.
- (BOOL) inInterstellarSpace;
- (void) setSystemDataKey:(NSString*) key value:(NSObject*) object;
- (void) setSystemDataForGalaxy:(OOGalaxyID) gnum planet:(OOSystemID) pnum key:(NSString *)key value:(id)object;
- (NSString *) getSystemName:(Random_Seed) s_seed;

View File

@ -983,7 +983,7 @@ static NSComparisonResult comparePrice(NSDictionary *dict1, NSDictionary *dict2,
OXP sets a system's station role to a role used by non-stations.
-- Ahruman 20080303
*/
if (![a_station isStation])
if (![a_station isStation] || ![a_station validForAddToUniverse])
{
OOLog(@"universe.setup.badStation", @"***** ERROR: Attempt to use non-station ship of type \"%@\" for role \"%@\" as system station, trying again with \"%@\".", [a_station name], stationDesc, defaultStationDesc);
@ -991,7 +991,7 @@ static NSComparisonResult comparePrice(NSDictionary *dict1, NSDictionary *dict2,
stationDesc = defaultStationDesc;
a_station = (StationEntity *)[self newShipWithRole:stationDesc]; // retain count = 1
if (![a_station isStation])
if (![a_station isStation] || ![a_station validForAddToUniverse])
{
OOLog(@"universe.setup.badStation", @"***** ERROR: On retry, rolled non-station ship of type \"%@\" for role \"%@\". Non-station ships should not have this role! Generating a stationless system.", [a_station name], stationDesc);
[a_station release];
@ -5904,7 +5904,40 @@ OOINLINE BOOL EntityInRange(Vector p1, Entity *e2, float range)
- (NSDictionary *) currentSystemData
{
return [self generateSystemData:system_seed];
if (![self inInterstellarSpace])
{
return [self generateSystemData:system_seed];
}
else
{
static NSDictionary *interstellarDict = nil;
if (interstellarDict == nil)
{
NSString *interstellarName = DESC(@"interstellar-space");
NSString *notApplicable = DESC(@"not-applicable");
NSNumber *minusOne = [NSNumber numberWithInt:-1];
NSNumber *zero = [NSNumber numberWithInt:0];
interstellarDict = [[NSDictionary alloc] initWithObjectsAndKeys:
interstellarName, KEY_NAME,
minusOne, KEY_GOVERNMENT,
minusOne, KEY_ECONOMY,
minusOne, KEY_TECHLEVEL,
zero, KEY_POPULATION,
zero, KEY_PRODUCTIVITY,
zero, KEY_RADIUS,
notApplicable, KEY_INHABITANTS,
notApplicable, KEY_DESCRIPTION,
nil];
}
return interstellarDict;
}
}
- (BOOL) inInterstellarSpace
{
return [self sun] == nil;
}