Cleaner obj_dump, now with range and visibility flag info.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3259 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
b77bd31cea
commit
3b75e46988
@ -208,4 +208,13 @@ MA 02110-1301, USA.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
- (NSString *) descriptionForObjDump
|
||||||
|
{
|
||||||
|
// Don't include range and visibility flag as they're irrelevant.
|
||||||
|
return [self descriptionForObjDumpBasic];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -238,10 +238,16 @@ extern size_t gTotalEntityMemory;
|
|||||||
- (double) findCollisionRadius;
|
- (double) findCollisionRadius;
|
||||||
- (Geometry*) geometry;
|
- (Geometry*) geometry;
|
||||||
- (void) drawEntity:(BOOL)immediate :(BOOL)translucent;
|
- (void) drawEntity:(BOOL)immediate :(BOOL)translucent;
|
||||||
|
- (BOOL) isVisible;
|
||||||
|
|
||||||
// For shader bindings.
|
// For shader bindings.
|
||||||
- (GLfloat) universalTime;
|
- (GLfloat) universalTime;
|
||||||
- (GLfloat) spawnTime;
|
- (GLfloat) spawnTime;
|
||||||
- (GLfloat) timeElapsedSinceSpawn;
|
- (GLfloat) timeElapsedSinceSpawn;
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
- (NSString *) descriptionForObjDumpBasic;
|
||||||
|
- (NSString *) descriptionForObjDump;
|
||||||
|
#endif
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -122,7 +122,7 @@ static NSString * const kOOLogEntityUpdateError = @"entity.linkedList.update.
|
|||||||
|
|
||||||
- (NSString *)descriptionComponents
|
- (NSString *)descriptionComponents
|
||||||
{
|
{
|
||||||
return [NSString stringWithFormat:@"ID: %u position: %@ scanClass: %@ status: %@", [self universalID], VectorDescription([self position]), ScanClassToString([self scanClass]), EntityStatusToString([self status])];
|
return [NSString stringWithFormat:@"position: %@ scanClass: %@ status: %@", VectorDescription([self position]), ScanClassToString([self scanClass]), EntityStatusToString([self status])];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -984,4 +984,34 @@ static NSString * const kOOLogEntityUpdateError = @"entity.linkedList.update.
|
|||||||
return [UNIVERSE getTime] - spawnTime;
|
return [UNIVERSE getTime] - spawnTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
- (NSString *) descriptionForObjDumpBasic
|
||||||
|
{
|
||||||
|
NSString *result = [self descriptionComponents];
|
||||||
|
if (result != nil) result = [NSString stringWithFormat:@"%@ %@", NSStringFromClass([self class]), result];
|
||||||
|
else result = [self description];
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (NSString *) descriptionForObjDump
|
||||||
|
{
|
||||||
|
NSString *result = [self descriptionForObjDumpBasic];
|
||||||
|
|
||||||
|
result = [result stringByAppendingFormat:@" range: %g (visible: %@)", distance([self position], [[PlayerEntity sharedPlayer] position]), [self isVisible] ? @"yes" : @"no"];
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
- (BOOL) isVisible
|
||||||
|
{
|
||||||
|
if ([self isSky] || [self isStellarObject]) return YES;
|
||||||
|
if (zero_distance > ABSOLUTE_NO_DRAW_DISTANCE2 || zero_distance > no_draw_distance) return NO;
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -175,7 +175,17 @@ MA 02110-1301, USA.
|
|||||||
|
|
||||||
- (NSString*) descriptionComponents
|
- (NSString*) descriptionComponents
|
||||||
{
|
{
|
||||||
return [NSString stringWithFormat:@"ID: %u position: %@ radius: %.3fkm", [self universalID], VectorDescription([self position]), 0.001 * [self radius]];
|
NSString *result = [NSString stringWithFormat:@"ID: %u position: %@ radius: %.3fkm", [self universalID], VectorDescription([self position]), 0.001 * [self radius]];
|
||||||
|
if ([self goneNova])
|
||||||
|
{
|
||||||
|
result = [result stringByAppendingString:@" (gone nova)"];
|
||||||
|
}
|
||||||
|
else if ([self willGoNova])
|
||||||
|
{
|
||||||
|
result = [result stringByAppendingString:@" (will go nova)"];
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9658,6 +9658,20 @@ static BOOL AuthorityPredicate(Entity *entity, void *parameter)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
- (NSString *) descriptionForObjDump
|
||||||
|
{
|
||||||
|
NSString *desc = [super descriptionForObjDump];
|
||||||
|
desc = [NSString stringWithFormat:@"%@ mass %g", desc, [self mass]];
|
||||||
|
if (![self isPlayer])
|
||||||
|
{
|
||||||
|
desc = [NSString stringWithFormat:@"%@ AI: %@", desc, [[self getAI] shortDescriptionComponents]];
|
||||||
|
}
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,6 +184,15 @@ MA 02110-1301, USA.
|
|||||||
CheckOpenGLErrors(@"SkyEntity after drawing %@", self);
|
CheckOpenGLErrors(@"SkyEntity after drawing %@", self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
- (NSString *) descriptionForObjDump
|
||||||
|
{
|
||||||
|
// Don't include range and visibility flag as they're irrelevant.
|
||||||
|
return [self descriptionForObjDumpBasic];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@ -515,8 +515,7 @@ OOINLINE size_t class_getInstanceSize(Class cls)
|
|||||||
OOLogIndent();
|
OOLogIndent();
|
||||||
for (i = 0; i < show_count; i++)
|
for (i = 0; i < show_count; i++)
|
||||||
{
|
{
|
||||||
ShipEntity* se = (sortedEntities[i]->isShip)? (id)sortedEntities[i]: nil;
|
OOLog(@"universe.objectDump", @"Ent:%4u %@", i, [sortedEntities[i] descriptionForObjDump]);
|
||||||
OOLog(@"universe.objectDump", @"-> Ent:%d\t\t%@ mass %.2f %@", i, sortedEntities[i], [sortedEntities[i] mass], [[se getAI] shortDescription]);
|
|
||||||
}
|
}
|
||||||
OOLogOutdent();
|
OOLogOutdent();
|
||||||
|
|
||||||
@ -3665,18 +3664,11 @@ static const OOMatrix starboard_matrix =
|
|||||||
// use a non-mutable copy so this can't be changed under us.
|
// use a non-mutable copy so this can't be changed under us.
|
||||||
for (i = 0; i < ent_count; i++)
|
for (i = 0; i < ent_count; i++)
|
||||||
{
|
{
|
||||||
// we check to see that we draw only the things that need to be drawn!
|
|
||||||
Entity *e = sortedEntities[i]; // ordered NEAREST -> FURTHEST AWAY
|
Entity *e = sortedEntities[i]; // ordered NEAREST -> FURTHEST AWAY
|
||||||
double zd2 = e->zero_distance;
|
if ([e isVisible])
|
||||||
if ([e isSky] || [e isStellarObject])
|
|
||||||
{
|
{
|
||||||
my_entities[draw_count++] = [e retain]; // planets and sky are always drawn!
|
my_entities[draw_count++] = [[e retain] autorelease];
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if ((zd2 > ABSOLUTE_NO_DRAW_DISTANCE2)||((e->isShip)&&(zd2 > e->no_draw_distance)))
|
|
||||||
continue;
|
|
||||||
// it passed all drawing tests - and it's not a planet or the sky - we can add it to the list
|
|
||||||
my_entities[draw_count++] = [e retain]; // retained
|
|
||||||
}
|
}
|
||||||
|
|
||||||
position = [player viewpointPosition];
|
position = [player viewpointPosition];
|
||||||
@ -3921,9 +3913,6 @@ static const OOMatrix starboard_matrix =
|
|||||||
// clear errors - and announce them
|
// clear errors - and announce them
|
||||||
CheckOpenGLErrors(@"Universe after all entity drawing is done.");
|
CheckOpenGLErrors(@"Universe after all entity drawing is done.");
|
||||||
|
|
||||||
for (i = 0; i < draw_count; i++)
|
|
||||||
[my_entities[i] release]; // released
|
|
||||||
|
|
||||||
no_update = NO; // allow other attempts to draw
|
no_update = NO; // allow other attempts to draw
|
||||||
|
|
||||||
#if (defined (SNAPSHOT_BUILD) && defined (OOLITE_SNAPSHOT_VERSION))
|
#if (defined (SNAPSHOT_BUILD) && defined (OOLITE_SNAPSHOT_VERSION))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user