More ai.load.failed.unknownAI fun: set AI's owner before its state machine to get clearer diagnostics. This was previously done when the ship was added to the universe - somewhat oddly - so there's a possibility this will break something. Also changed unassigned AI name to <none>.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2487 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
717de3c0e3
commit
e085c50004
@ -104,7 +104,7 @@ static AI *sCurrentlyRunningAI = nil;
|
||||
nextThinkTime = [[NSDate distantFuture] timeIntervalSinceNow]; // don't think for a while
|
||||
thinkTimeInterval = AI_THINK_INTERVAL;
|
||||
|
||||
stateMachineName = [[NSString stringWithString:@"None allocated"] retain]; // no initial brain
|
||||
stateMachineName = [[NSString stringWithString:@"<no AI>"] retain]; // no initial brain
|
||||
|
||||
return self;
|
||||
}
|
||||
@ -736,7 +736,7 @@ static AI *sCurrentlyRunningAI = nil;
|
||||
if (newSM == nil)
|
||||
{
|
||||
[cacheMgr setObject:@"nil" forKey:smName inCache:@"AIs"];
|
||||
OOLog(@"ai.load.failed.unknownAI", @"Can't switch AI for %@ from %@:%@ to %@ - could not load file.", [[self owner] shortDescription], [self name], [self state], smName);
|
||||
OOLog(@"ai.load.failed.unknownAI", @"Can't switch AI for %@ from %@:%@ to \"%@\" - could not load file.", [[self owner] shortDescription], [self name], [self state], smName);
|
||||
NS_VALUERETURN(nil, NSDictionary *);
|
||||
}
|
||||
|
||||
|
@ -260,6 +260,7 @@ static NSString * const kOOLogEntityBehaviourChanged = @"entity.behaviour.change
|
||||
|
||||
[shipAI autorelease];
|
||||
shipAI = [[AI alloc] init];
|
||||
[shipAI setOwner:self];
|
||||
[shipAI setStateMachine:[shipDict oo_stringForKey:@"ai_type" defaultValue:@"nullAI.plist"]];
|
||||
|
||||
max_cargo = [shipDict oo_unsignedIntForKey:@"max_cargo"];
|
||||
|
Loading…
x
Reference in New Issue
Block a user