Fixed blank names for location bookmarks on Mac OS X.

pull/3/head
Chris Laurel 2008-12-01 20:46:31 +00:00
parent 81ebd931d2
commit 022409c73e
1 changed files with 14 additions and 26 deletions

View File

@ -11,6 +11,7 @@
#import "CelestiaBody_PrivateAPI.h"
#import "CelestiaGalaxy_PrivateAPI.h"
#import "CelestiaStar_PrivateAPI.h"
#import "CelestiaLocation.h"
#import "NSString_ObjCPlusPlus.h"
#import "CelestiaUniversalCoord_PrivateAPI.h"
#import "CelestiaAppCore.h"
@ -61,6 +62,10 @@
{
return [self initWithSelection:Selection([g galaxy])];
}
-(CelestiaSelection*)initWithCelestiaLocation:(CelestiaLocation*)g
{
return [self initWithSelection:Selection([g location])];
}
-(CelestiaBody *)body
{
if ([self selection].getType() != Selection::Type_Body) return nil;
@ -89,6 +94,11 @@
if ([self selection].getType() != Selection::Type_DeepSky) return nil;
return [[[CelestiaGalaxy alloc] initWithGalaxy:((Galaxy*)[self selection].deepsky())] autorelease];
}
-(CelestiaLocation*)location
{
if ([self selection].getType() != Selection::Type_Location) return nil;
return [[[CelestiaLocation alloc] initWithLocation:((Location*)[self selection].location())] autorelease];
}
-(NSString *)name
{
return [NSString stringWithStdString:[self selection].getName()];
@ -118,32 +128,10 @@
else if ([self body] != NULL)
{
name = [[self body] name];
/*
PlanetarySystem* system = body->getSystem();
while (system != NULL)
{
Body* parent = system->getPrimaryBody();
if (parent != NULL)
{
name = parent->getName() + '/' + name;
system = parent->getSystem();
}
else
{
const Star* parentStar = system->getStar();
if (parentStar != NULL)
{
char buf[20];
sprintf(buf, "#%d", parentStar->getCatalogNumber());
name = string(buf) + '/' + name;
}
system = NULL;
}
}
*/
}
else if ([self location] != NULL)
{
name = [[self location] name];
}
else
{