Added warning when trying to switch to a non-existant AI. Fixed ship inspectors.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2406 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2009-09-05 21:39:26 +00:00
parent 9c01b00084
commit 26f3650ef6
3 changed files with 22 additions and 19 deletions

View File

@ -79,6 +79,7 @@
ai.invalidFormat.action = inherit;
ai.unpermittedMethod = $aiError;
ai.load = no;
ai.load.failed.unknownAI = $aiError;
ai.invalid.notAStation = $aiError; // Warning when station AI message is used on non-station.

View File

@ -286,25 +286,26 @@ static AI *sCurrentlyRunningAI = nil;
[stateMachine release]; // release old state machine
stateMachine = [newSM retain];
nextThinkTime = 0.0; // think at next tick
[currentState release];
currentState = @"GLOBAL";
/* CRASH in objc_msgSend, apparently on [self reactToMessage:@"ENTER"] (1.69, OS X/x86).
Analysis: self corrupted. We're being called by __NSFireDelayedPerform, which doesn't go
through -[NSObject performSelector:withObject:], suggesting it's using IMP caching. An
invalid self is therefore possible.
Attempted fix: new delayed dispatch with trampoline, see -[AI setStateMachine:afterDelay:].
-- Ahruman, 20070706
*/
[self reactToMessage:@"ENTER"];
// refresh name
[self refreshOwnerDesc];
// refresh stateMachineName
[stateMachineName release];
stateMachineName = [smName copy];
}
[currentState release];
currentState = @"GLOBAL";
/* CRASH in objc_msgSend, apparently on [self reactToMessage:@"ENTER"] (1.69, OS X/x86).
Analysis: self corrupted. We're being called by __NSFireDelayedPerform, which doesn't go
through -[NSObject performSelector:withObject:], suggesting it's using IMP caching. An
invalid self is therefore possible.
Attempted fix: new delayed dispatch with trampoline, see -[AI setStateMachine:afterDelay:].
-- Ahruman, 20070706
*/
[self reactToMessage:@"ENTER"];
// refresh name
[self refreshOwnerDesc];
// refresh stateMachineName
[stateMachineName release];
stateMachineName = [smName copy];
}
@ -729,6 +730,7 @@ static AI *sCurrentlyRunningAI = nil;
if (newSM == nil)
{
[cacheMgr setObject:@"nil" forKey:smName inCache:@"AIs"];
OOLog(@"ai.load.failed.unknownAI", @"Can't switch AI from %@:%@ to %@ - could not load file.", [self name], [self state], smName);
NS_VALUERETURN(nil, NSDictionary *);
}

View File

@ -3600,7 +3600,7 @@ static GLfloat mascem_color2[4] = { 0.4, 0.1, 0.4, 1.0}; // purple
}
#if NDEBUG
#ifndef NDEBUG
- (OOShipGroup *) rawEscortGroup
{
return _escortGroup;