Fixed a bug where subentity relationships would be messed up by -becomeLargeExplosion (currently only used for the player). Better diagnostics for bad AIs.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1458 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2008-03-05 23:45:09 +00:00
parent 4c3cf42f7e
commit 5f09cc936a
5 changed files with 52 additions and 33 deletions

View File

@ -1035,7 +1035,7 @@
1A2316E70B9CFAD700EF0852 /* keyconfig.plist */ = {isa = PBXFileReference; fileEncoding = 4; languageSpecificationIdentifier = plist; lastKnownFileType = text.xml; path = keyconfig.plist; sourceTree = "<group>"; };
1A2316E80B9CFAD700EF0852 /* logcontrol.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = logcontrol.plist; sourceTree = "<group>"; };
1A2316E90B9CFAD700EF0852 /* missiontext.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = missiontext.plist; sourceTree = "<group>"; };
1A2316EB0B9CFAD700EF0852 /* shipdata.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = shipdata.plist; sourceTree = "<group>"; };
1A2316EB0B9CFAD700EF0852 /* shipdata.plist */ = {isa = PBXFileReference; explicitFileType = text.plist; fileEncoding = 4; path = shipdata.plist; sourceTree = "<group>"; };
1A2316EC0B9CFAD700EF0852 /* shipyard.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = shipyard.plist; sourceTree = "<group>"; };
1A2316ED0B9CFAD700EF0852 /* speech_pronunciation_guide.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = speech_pronunciation_guide.plist; sourceTree = "<group>"; };
1A2317910B9D022400EF0852 /* buoyAI.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = buoyAI.plist; sourceTree = "<group>"; };

View File

@ -124,7 +124,8 @@
entity.linkedList.add.error = $linkedListError;
entity.linkedList.remove = inherit;
entity.linkedList.remove.error = $linkedListError;
entity.linkedList.verify.error = no; //$linkedListError; // Non-fatal error that looks scary.
entity.linkedList.verify = no; //$linkedListError; // Non-fatal errors that look scary.
entity.linkedList.verify.error = inherit;
entity.linkedList.verify.rebuild = inherit;
entity.linkedList.update.error = $linkedListError;

View File

@ -136,6 +136,14 @@
roles = "alloy oolite-alloy";
scanClass = "CLASS_CARGO";
thrust = 0;
materials =
{
"metal.png" =
{
shininess = 15;
specular = (0.55, 0.58, 0.6, 1.0);
};
};
};
"anaconda" =
{
@ -811,6 +819,14 @@
thrust = 100;
unpiloted = yes;
weapon_energy = 0;
materials =
{
"target_metal.png" =
{
shininess = 15;
specular = (0.55, 0.58, 0.6, 1.0);
};
};
};
"cloaking-device" =
{
@ -828,24 +844,6 @@
roles = "cloaking-device oolite-cloaking-device";
scanClass = "CLASS_CARGO";
script = "oolite-cloaking-device-pod.js";
/* script_actions =
(
"testForEquipment: EQ_CLOAKING_DEVICE",
{
conditions = ("foundEquipment_bool equal NO");
do =
(
"awardEquipment: EQ_CLOAKING_DEVICE"
// To consider:
// "set: mission_TL_FOR_EQ_CLOAKING_DEVICE 14"
);
else =
(
"awardCargo: 100 Gold"
);
}
); */
thrust = 0;
unpiloted = yes;
};
@ -2226,6 +2224,14 @@
roles = "alloy oolite-scarred-alloy";
scanClass = "CLASS_CARGO";
thrust = 0;
materials =
{
"scarred_metal.png" =
{
shininess = 15;
specular = (0.55, 0.58, 0.6, 1.0);
};
};
};
"shuttle" =
{

View File

@ -339,7 +339,7 @@ static AI *sCurrentlyRunningAI = nil;
#ifndef NDEBUG
if (currentState != nil && ![message isEqual:@"UPDATE"] && [owner reportAIMessages])
{
OOLog(@"ai.message.receive", @"AI for %@ in state '%@' receives message '%@'", ownerDesc, currentState, message);
OOLog(@"ai.message.receive", @"AI %@ for %@ in state '%@' receives message '%@'", stateMachineName, ownerDesc, currentState, message);
}
#endif
@ -420,17 +420,17 @@ static AI *sCurrentlyRunningAI = nil;
if ([selectorStr isEqual:@"setStateTo:"]) [self setState:dataString];
else if ([selectorStr isEqual:@"debugMessage:"])
{
OOLog(@"ai.takeAction.debugNessage", @"AI-DEBUG MESSAGE from %@ : %@", ownerDesc, dataString);
OOLog(@"ai.takeAction.debugMessage", @"AI-DEBUG MESSAGE from %@ : %@", ownerDesc, dataString);
}
else
{
OOLog(@"ai.takeAction.badSelector", @"***** %@ does not respond to %@", ownerDesc, selectorStr);
OOLog(@"ai.takeAction.badSelector", @"***** ERROR in AI %@ in state %@: %@ does not respond to %@", stateMachineName, currentState, ownerDesc, selectorStr);
}
}
}
else
{
OOLog(@"ai.takeAction.orphaned", @"***** AI %@, trying to perform %@, is orphaned (no owner)", self, selectorStr);
OOLog(@"ai.takeAction.orphaned", @"***** AI %@, trying to perform %@, is orphaned (no owner)", stateMachineName, selectorStr);
}
}
else

View File

@ -3986,11 +3986,7 @@ static GLfloat mascem_color2[4] = { 0.4, 0.1, 0.4, 1.0}; // purple
[UNIVERSE addEntity:sse];
[sse becomeExplosion];
}
else
{
// Note: done by becomeExplosion for subs - several times, in fact.
[se setOwner:nil];
}
[se setOwner:nil];
}
[subEntities release]; // releases each subentity too!
subEntities = nil;
@ -4268,10 +4264,26 @@ Vector positionOffsetForShipInRotationToAlignment(ShipEntity* ship, Quaternion q
}
[cargo removeObjectAtIndex:0];
}
//
if (!isPlayer)
[UNIVERSE removeEntity:self];
NSEnumerator *subEnum = nil;
Entity *se = nil;
for (subEnum = [self subEntityEnumerator]; (se = [subEnum nextObject]); )
{
if ([se isShip])
{
ShipEntity *sse = (ShipEntity *)se;
[sse setSuppressExplosion:suppressExplosion];
[sse setPosition:[sse absolutePositionForSubentity]];
[UNIVERSE addEntity:sse];
[sse becomeExplosion];
}
[se setOwner:nil];
}
[subEntities release]; // releases each subentity too!
subEntities = nil;
if (!isPlayer) [UNIVERSE removeEntity:self];
}