Moved more messages over to OOLogging, moved most log message classes into the relevant files rather than OOLogging.h to reduce recompiling.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@810 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2007-03-03 16:07:19 +00:00
parent 73e9925e1f
commit bb28b341c1
9 changed files with 75 additions and 75 deletions

View File

@ -34,6 +34,14 @@ files.notloaded = inherit; // A file should have been loaded at some earlier
scripting = inherit;
scripting.debug = inherit;
scripting.debug.onoff = inherit;
scripting.scriptaction = inherit;
scripting.scriptaction.scriptaction = inherit;
scripting.scriptaction.noaction = inherit;
scripting.scriptaction.expanded = inherit;
scripting.scriptaction.badselector = inherit;
scripting.spawn = inherit;
scripting.spawn.spawned = inherit;
scripting.spawn.failed = inherit;
rendering = inherit;
rendering.opengl = inherit;
@ -78,6 +86,9 @@ datacache.found = inherit;
datacache.notfound = inherit;
datacache.rebuild = inherit;
universe = inherit;
universe.populate = inherit; // “Populating a system with…” message when generating a star system
// Mac-specific
growl = inherit;
growl.error = inherit;

View File

@ -29,6 +29,14 @@ MA 02110-1301, USA.
#import "OOLogging.h"
static NSString * const kOOLogAIReceiveMessage = @"ai.message.receive";
static NSString * const kOOLogAITakeAction = @"ai.takeaction.takeaction";
static NSString * const kOOLogAINoAction = @"ai.takeaction.noaction";
static NSString * const kOOLogAITakeActionOrphaned = @"ai.takeaction.orphaned";
static NSString * const kOOLogAIDebugMessage = @"ai.takeaction.debugmessage";
static NSString * const kOOLogAIBadSelector = @"ai.takeaction.badselector";
@implementation AI
- (id) prepare

View File

@ -36,6 +36,19 @@ MA 02110-1301, USA.
#import "NSScannerOOExtensions.h"
static NSString * const kOOLogEntityAddToList = @"entity.linkedlist.add";
static NSString * const kOOLogEntityAddToListError = @"entity.linkedlist.add.error";
static NSString * const kOOLogEntityRemoveFromList = @"entity.linkedlist.remove";
static NSString * const kOOLogEntityRemoveFromListError = @"entity.linkedlist.remove.error";
static NSString * const kOOLogEntityVerificationError = @"entity.linkedlist.verify.error";
static NSString * const kOOLogEntityUpdateError = @"entity.linkedlist.update.error";
static NSString * const kOOLogStringVectorConversion = @"strings.conversion.vector";
static NSString * const kOOLogStringQuaternionConversion = @"strings.conversion.quaternion";
static NSString * const kOOLogStringVecAndQuatConversion = @"strings.conversion.vectorandquaternion";
static NSString * const kOOLogStringRandomSeedConversion = @"strings.conversion.randomseed";
// global flag for VAR
BOOL global_usingVAR;
BOOL global_testForVAR;
@ -1180,8 +1193,7 @@ static Universe *data_store_universe;
//
- (void) resetFramesFromFrame:(Frame) resetFrame withVelocity:(Vector) vel1
{
if (isPlayer)
NSLog(@"DEBUG ** resetting track for %@ **", self);
// if (isPlayer) NSLog(@"DEBUG ** resetting track for %@ **", self);
Vector v1 = make_vector( 0.1 * vel1.x, 0.1 * vel1.y, 0.1 * vel1.z);
double t_now = [universe getTime];
@ -2454,12 +2466,12 @@ static Universe *data_store_universe;
if (strstr(s, "GL_APPLE_vertex_array_range") == 0)
{
global_usingVAR &= NO;
NSLog(@"Vertex Array Range optimisation - not supported");
OOLog(kOOLogOpenGLExtensionsVAR, @"Vertex Array Range optimisation - not supported");
return NO;
}
else
{
NSLog(@"Vertex Array Range optimisation - supported");
OOLog(kOOLogOpenGLExtensionsVAR, @"Vertex Array Range optimisation - supported");
global_usingVAR |= YES;
}
}

View File

@ -82,43 +82,14 @@ void OOLogWithFunctionFileAndLineAndArguments(NSString *inMessageClass, const ch
*/
extern NSString * const kOOLogSubclassResponsibility; // @"general.subclassresponsibility"
extern NSString * const kOOLogParameterError; // @"general.parametererror"
extern NSString * const kOOLogException; // @"exception"
extern NSString * const kOOLogFileNotFound; // @"files.notfound"
extern NSString * const kOOLogFileNotLoaded; // @"files.notloaded"
extern NSString * const kOOLogScriptDebug; // @"scripting.debug"
extern NSString * const kOOLogScriptDebugOnOff; // @"scripting.debug.onoff"
extern NSString * const kOOLogOpenGLError; // @"rendering.opengl.error"
extern NSString * const kOOLogOpenGLVersion; // @"rendering.opengl.version"
extern NSString * const kOOLogOpenGLShaderSupport; // @"rendering.opengl.shaders.support"
extern NSString * const kOOLogOpenGLExtensions; // @"rendering.opengl.extensions"
extern NSString * const kOOLogOpenGLExtensionsVAR; // @"rendering.opengl.extensions.var"
extern NSString * const kOOLogOpenGLStateDump; // @"rendering.opengl.statedump"
extern NSString * const kOOLogDumpSearchPaths; // @"searchpaths.dumpall"
extern NSString * const kOOLogStringValueConversion; // @"strings.conversion"
extern NSString * const kOOLogStringVectorConversion; // @"strings.conversion.vector"
extern NSString * const kOOLogStringQuaternionConversion; // @"strings.conversion.quaternion"
extern NSString * const kOOLogStringVecAndQuatConversion; // @"strings.conversion.vectorandquaternion"
extern NSString * const kOOLogStringRandomSeedConversion; // @"strings.conversion.randomseed"
extern NSString * const kOOLogEntityAddToList; // @"entity.linkedlist.add"
extern NSString * const kOOLogEntityAddToListError; // @"entity.linkedlist.add.error"
extern NSString * const kOOLogEntityRemoveFromList; // @"entity.linkedlist.remove"
extern NSString * const kOOLogEntityRemoveFromListError; // @"entity.linkedlist.remove.error"
extern NSString * const kOOLogEntityVerificationError; // @"entity.linkedlist.verify.error"
extern NSString * const kOOLogEntityUpdateError; // @"entity.linkedlist.update.error"
extern NSString * const kOOLogAIReceiveMessage; // @"ai.message.receive"
extern NSString * const kOOLogAITakeAction; // @"ai.takeaction.takeaction"
extern NSString * const kOOLogAINoAction; // @"ai.takeaction.noaction"
extern NSString * const kOOLogAITakeActionOrphaned; // @"ai.takeaction.orphaned"
extern NSString * const kOOLogAIDebugMessage; // @"ai.takeaction.debugmessage"
extern NSString * const kOOLogAIBadSelector; // @"ai.takeaction.badselector"
extern NSString * const kOOLogDataCacheFound; // @"datacache.found"
extern NSString * const kOOLogDataCacheNotFound; // @"datacache.notfound"
extern NSString * const kOOLogDataCacheRebuild; // @"datacache.rebuild"

View File

@ -237,34 +237,12 @@ NSString * const kOOLogParameterError = @"general.parametererror";
NSString * const kOOLogException = @"exception";
NSString * const kOOLogFileNotFound = @"files.notfound";
NSString * const kOOLogFileNotLoaded = @"files.notloaded";
NSString * const kOOLogScriptDebug = @"scripting.debug";
NSString * const kOOLogScriptDebugOnOff = @"scripting.debug.onoff";
NSString * const kOOLogOpenGLError = @"rendering.opengl.error";
NSString * const kOOLogOpenGLVersion = @"rendering.opengl.version";
NSString * const kOOLogOpenGLShaderSupport = @"rendering.opengl.shaders.support";
NSString * const kOOLogOpenGLExtensions = @"rendering.opengl.extensions";
NSString * const kOOLogOpenGLExtensionsVAR = @"rendering.opengl.extensions.var";
NSString * const kOOLogOpenGLStateDump = @"rendering.opengl.statedump";
NSString * const kOOLogDumpSearchPaths = @"searchpaths.dumpall";
NSString * const kOOLogStringValueConversion = @"strings.conversion";
NSString * const kOOLogStringVectorConversion = @"strings.conversion.vector";
NSString * const kOOLogStringQuaternionConversion = @"strings.conversion.quaternion";
NSString * const kOOLogStringVecAndQuatConversion = @"strings.conversion.vectorandquaternion";
NSString * const kOOLogStringRandomSeedConversion = @"strings.conversion.randomseed";
NSString * const kOOLogEntityAddToList = @"entity.linkedlist.add";
NSString * const kOOLogEntityAddToListError = @"entity.linkedlist.add.error";
NSString * const kOOLogEntityRemoveFromList = @"entity.linkedlist.remove";
NSString * const kOOLogEntityRemoveFromListError = @"entity.linkedlist.remove.error";
NSString * const kOOLogEntityVerificationError = @"entity.linkedlist.verify.error";
NSString * const kOOLogEntityUpdateError = @"entity.linkedlist.update.error";
NSString * const kOOLogAIReceiveMessage = @"ai.message.receive";
NSString * const kOOLogAITakeAction = @"ai.takeaction.takeaction";
NSString * const kOOLogAINoAction = @"ai.takeaction.noaction";
NSString * const kOOLogAITakeActionOrphaned = @"ai.takeaction.orphaned";
NSString * const kOOLogAIDebugMessage = @"ai.takeaction.debugmessage";
NSString * const kOOLogAIBadSelector = @"ai.takeaction.badselector";
NSString * const kOOLogDataCacheFound = @"datacache.found";
NSString * const kOOLogDataCacheNotFound = @"datacache.notfound";
NSString * const kOOLogDataCacheRebuild = @"datacache.rebuild";
static void OOLogInternal_(const char *inFunction, NSString *inFormat, ...)

View File

@ -36,6 +36,16 @@ MA 02110-1301, USA.
#import "Comparison.h"
#endif
static NSString * const kOOLogScriptDebug = @"scripting.debug";
static NSString * const kOOLogScriptDebugOnOff = @"scripting.debug.onoff";
static NSString * const kOOLogScriptAction = @"scripting.scriptaction.scriptaction";
static NSString * const kOOLogScriptNoAction = @"scripting.scriptaction.noaction";
static NSString * const kOOLogScriptActionExpanded = @"scripting.scriptaction.expanded";
static NSString * const kOOLogScriptActionBadSelector = @"scripting.scriptaction.badselector";
static NSString * const kOOLogScriptSpawnOK = @"scripting.spawn.spawned";
static NSString * const kOOLogScriptSpawnFailed = @"scripting.spawn.failed";
@implementation PlayerEntity (Scripting)
static NSString * mission_string_value;
@ -156,11 +166,11 @@ static NSString * mission_key;
SEL _selector;
if (debug & DEBUG_SCRIPT)
NSLog(@"DEBUG ::::: scriptAction: \"%@\"", scriptAction);
OOLog(kOOLogScriptAction, @"scriptAction: \"%@\"", scriptAction);
if ([tokens count] < 1)
{
NSLog(@"***** No scriptAction '%@'",scriptAction);
OOLog(kOOLogScriptNoAction, @"***** No scriptAction '%@'",scriptAction);
return;
}
@ -172,7 +182,7 @@ static NSString * mission_key;
valueString = [[tokens componentsJoinedByString:@" "] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
valueString = [universe expandDescriptionWithLocals:valueString forSystem:[self system_seed] withLocalVariables:locals];
if (debug & DEBUG_SCRIPT)
NSLog(@"DEBUG ::::: after expansion: \"%@ %@\"", selectorString, valueString);
OOLog(kOOLogScriptActionExpanded, @"scriptAction after expansion: \"%@ %@\"", selectorString, valueString);
}
_selector = NSSelectorFromString(selectorString);
@ -188,7 +198,7 @@ static NSString * mission_key;
if (![self respondsToSelector:_selector])
{
NSLog(@"***** PlayerEntity DOES NOT RESPOND TO scriptAction: \"%@\"", scriptAction);
OOLog(kOOLogScriptActionBadSelector, @"***** PlayerEntity DOES NOT RESPOND TO scriptAction: \"%@\"", scriptAction);
return;
}
@ -1262,9 +1272,9 @@ static int scriptRandomSeed = -1; // ensure proper random function
if (debug & DEBUG_SCRIPT)
{
if (spawnedOkay)
NSLog(@"DEBUG Spawned ship with shipdata key '%@'.", ship_key);
OOLog(kOOLogScriptSpawnOK, @"DEBUG Spawned ship with shipdata key '%@'.", ship_key);
else
NSLog(@"***** Could not spawn ship with shipdata key '%@'.", ship_key);
NSLog(kOOLogScriptSpawnFailed, @"***** Could not spawn ship with shipdata key '%@'.", ship_key);
}
}
@ -1863,7 +1873,7 @@ static int scriptRandomSeed = -1; // ensure proper random function
- (void) debugMessage:(NSString *)args
{
NSLog(@"SCRIPT debugMessage: %@", args);
OOLog(kOOLogScriptDebug, @"SCRIPT debugMessage: %@", args);
}
- (NSString*) replaceVariablesInString:(NSString*) args

View File

@ -28,6 +28,10 @@ MA 02110-1301, USA.
#import "OOSound.h"
#import "OOLogging.h"
static NSString * const kOOLogDumpSearchPaths = @"searchpaths.dumpall";
extern NSDictionary* parseScripts(NSString* script);
@implementation ResourceManager

View File

@ -53,7 +53,7 @@ GLuint max_texture_dimension = 512; // conservative start
glGetIntegerv( GL_MAX_TEXTURE_SIZE, &result);
max_texture_dimension = result;
done_maxsize_test = YES;
NSLog(@"TESTING: GL_MAX_TEXTURE_SIZE = %d", max_texture_dimension);
// NSLog(@"TESTING: GL_MAX_TEXTURE_SIZE = %d", max_texture_dimension);
return max_texture_dimension;
}

View File

@ -45,6 +45,12 @@ MA 02110-1301, USA.
#define MAX_NUMBER_OF_SOLAR_SYSTEM_ENTITIES 20
static NSString * const kOOLogDataCacheFound = @"datacache.found";
static NSString * const kOOLogDataCacheNotFound = @"datacache.notfound";
static NSString * const kOOLogDataCacheRebuild = @"datacache.rebuild";
static NSString * const kOOLogUniversePopulate = @"universe.populate";
@implementation Universe
- (id) init
@ -1244,7 +1250,7 @@ GLfloat docked_light_specular[] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5,
ranrot_srand([[NSDate date] timeIntervalSince1970]); // reset randomiser with current time
NSLog(@"Populating a system with economy %d, and government %d", economy, government);
OOLog(kOOLogUniversePopulate, @"Populating a system with economy %d, and government %d", economy, government);
// traders
int trading_parties = (9 - economy); // 2 .. 9
@ -1254,11 +1260,11 @@ GLfloat docked_light_specular[] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5,
while (trading_parties > 15)
trading_parties = 1 + (ranrot_rand() % trading_parties); // reduce
NSLog(@"... adding %d trading vessels", trading_parties);
OOLog(kOOLogUniversePopulate, @"... adding %d trading vessels", trading_parties);
int skim_trading_parties = (ranrot_rand() & 3) + trading_parties * (ranrot_rand() & 31) / 120; // about 12%
NSLog(@"... adding %d sun skimming vessels", skim_trading_parties);
OOLog(kOOLogUniversePopulate, @"... adding %d sun skimming vessels", skim_trading_parties);
// pirates
int anarchy = (8 - government);
@ -1268,11 +1274,11 @@ GLfloat docked_light_specular[] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5,
while (raiding_parties > 25)
raiding_parties = 12 + (ranrot_rand() % raiding_parties); // reduce
NSLog(@"... adding %d pirate vessels", raiding_parties);
OOLog(kOOLogUniversePopulate, @"... adding %d pirate vessels", raiding_parties);
int skim_raiding_parties = ((randf() < 0.14 * economy)? 1:0) + raiding_parties * (ranrot_rand() & 31) / 120; // about 12%
NSLog(@"... adding %d sun skim pirates", skim_raiding_parties);
OOLog(kOOLogUniversePopulate, @"... adding %d sun skim pirates", skim_raiding_parties);
// bounty-hunters and the law
int hunting_parties = (1 + government) * trading_parties / 8;
@ -1286,17 +1292,17 @@ GLfloat docked_light_specular[] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5,
if (hunting_parties < 1)
hunting_parties = 1;
NSLog(@"... adding %d law/bounty-hunter vessels", hunting_parties);
OOLog(kOOLogUniversePopulate, @"... adding %d law/bounty-hunter vessels", hunting_parties);
int skim_hunting_parties = ((randf() < 0.14 * government)? 1:0) + hunting_parties * (ranrot_rand() & 31) / 160; // about 10%
NSLog(@"... adding %d sun skim law/bounty hunter vessels", skim_hunting_parties);
OOLog(kOOLogUniversePopulate, @"... adding %d sun skim law/bounty hunter vessels", skim_hunting_parties);
int thargoid_parties = 0;
while ((ranrot_rand() % 100) < thargoidChance)
thargoid_parties++;
NSLog(@"... adding %d Thargoid warships", thargoid_parties);
OOLog(kOOLogUniversePopulate, @"... adding %d Thargoid warships", thargoid_parties);
int rock_clusters = ranrot_rand() % 3;
if (trading_parties + raiding_parties + hunting_parties < 10)
@ -1304,11 +1310,11 @@ GLfloat docked_light_specular[] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5,
rock_clusters *= 2;
NSLog(@"... adding %d asteroid clusters", rock_clusters);
OOLog(kOOLogUniversePopulate, @"... adding %d asteroid clusters", rock_clusters);
int total_clicks = trading_parties + raiding_parties + hunting_parties + thargoid_parties + rock_clusters + skim_hunting_parties + skim_raiding_parties + skim_trading_parties;
NSLog(@"... for a total of %d ships", total_clicks);
OOLog(kOOLogUniversePopulate, @"... for a total of %d ships", total_clicks);
Vector v_route1 = p1_pos;
v_route1.x -= h1_pos.x; v_route1.y -= h1_pos.y; v_route1.z -= h1_pos.z;