From 47213c7a5ea6a3164f89026a983db0c4d2e66938 Mon Sep 17 00:00:00 2001 From: cmdrjames Date: Wed, 18 Mar 2009 00:39:57 +0000 Subject: [PATCH] fix for pirate cove defense-ships not working git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2096 127b21dd-08f5-0310-b4b7-95ae10353056 --- Resources/AIs/pirateAI.plist | 4 ++-- src/Core/Entities/ShipEntity.m | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Resources/AIs/pirateAI.plist b/Resources/AIs/pirateAI.plist index 17812e35..58d4328c 100644 --- a/Resources/AIs/pirateAI.plist +++ b/Resources/AIs/pirateAI.plist @@ -68,14 +68,14 @@ }; "TRAVEL_TO_LURK_AREA" = { - ENTER = - (setDestinationToCurrentLocation, "setDesiredRangeTo: 1500.0", performFlyToRangeFromDestination); + ENTER = (setDestinationToCurrentLocation, "setDesiredRangeTo: 3500.0", performFlyToRangeFromDestination); ATTACKED = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP"); "DESIRED_RANGE_ACHIEVED" = ("setStateTo: LURK"); "GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP"); "INCOMING_MISSILE" = (fightOrFleeMissile, "setStateTo: FLEE"); "ENTER WORMHOLE" = ("setStateTo: ENTER_WORMHOLE"); "EXITED WITCHSPACE" = ("switchAITo: enteringPirateAI.plist"); // Unreachable? If so, enteringPirateAI and enteringTraderAI are unused. + "FRUSTRATED" = ("setStateTo: LURK"); }; "CONSIDER_DOCKING" = { diff --git a/src/Core/Entities/ShipEntity.m b/src/Core/Entities/ShipEntity.m index fb3857b3..94dccfd1 100644 --- a/src/Core/Entities/ShipEntity.m +++ b/src/Core/Entities/ShipEntity.m @@ -1649,13 +1649,18 @@ ShipEntity* doOctreesCollide(ShipEntity* prime, ShipEntity* other) for (escortEnum = [self escortEnumerator]; (escort = [escortEnum nextObject]); ) { - if ([self scanClass] != [escort scanClass]) { - //you are only allowed to escort something with the same scanclass, so you are on your own now - [escort setGroup:NO_TARGET]; - } [escort setDestination:[self coordinatesForEscortPosition:i++]]; } } + if ([self escortGroup] != nil) + { + ShipEntity *leader = [[self escortGroup] leader]; + if (leader != nil && ([leader scanClass] != [self scanClass])) { + OOLog(@"ship.sanityCheck.failed", @"Ship %@ escorting %@ with wrong scanclass!", self, leader); + [[self escortGroup] removeShip:self]; + [[self escortGroup] release]; + } + } } // subentity rotation