Fix for: [ Bug #14011 ] Carriers should have groupID set.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1990 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
cmdrjames 2009-01-11 15:20:01 +00:00
parent b2e61962a7
commit f9c45d3323
2 changed files with 15 additions and 2 deletions

View File

@ -3792,6 +3792,11 @@ NSComparisonResult planetSort(id i1, id i2, void* context)
- (void) setCrew: (NSArray*) crewArray
{
if (isUnpiloted)
{
//unpiloted ships cannot have crew
return;
}
//do not set to hulk here when crew is nill (or 0). Some things like missiles have no crew.
[crew autorelease];
crew = [crewArray copy];

View File

@ -1525,7 +1525,7 @@ static NSDictionary* instructions(int station_id, Vector coords, float speed, fl
}
[defense_ship setOwner: self];
if (groupID != NO_TARGET)
if (groupID == NO_TARGET)
{
[self setGroupID:universalID];
}
@ -1741,13 +1741,21 @@ static NSDictionary* instructions(int station_id, Vector coords, float speed, fl
if (escort_ship)
{
if (![escort_ship crew])
if (![escort_ship crew] && ![escort_ship isUnpiloted])
[escort_ship setCrew:[NSArray arrayWithObject:
[OOCharacter randomCharacterWithRole: @"hunter"
andOriginalSystem: [UNIVERSE systemSeed]]]];
[escort_ship setScanClass: CLASS_NEUTRAL];
[escort_ship setCargoFlag: CARGO_FLAG_FULL_PLENTIFUL];
[escort_ship setOwner: self];
if (groupID == NO_TARGET)
{
[self setGroupID:universalID];
}
[escort_ship setGroupID:groupID]; // who's your Daddy
[[escort_ship getAI] setStateMachine:@"escortAI.plist"];
[self addShipToLaunchQueue:escort_ship];