- another fix to scripted_cargo so that it now also works correct as before with any scoopeble object. (like escape pods and alloys)

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3218 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Eric Walch 2010-04-25 10:51:29 +00:00
parent 2cc1846926
commit 87422d10be
2 changed files with 11 additions and 8 deletions

View File

@ -5017,7 +5017,7 @@ NSComparisonResult ComparePlanetsBySurfaceDistance(id i1, id i2, void* context)
- (void) setCommodity:(OOCargoType)co_type andAmount:(OOCargoQuantity)co_amount - (void) setCommodity:(OOCargoType)co_type andAmount:(OOCargoQuantity)co_amount
{ {
if (co_type != CARGO_UNDEFINED) if (co_type != CARGO_UNDEFINED && cargo_type != CARGO_SCRIPTED_ITEM)
{ {
commodity_type = co_type; commodity_type = co_type;
commodity_amount = co_amount; commodity_amount = co_amount;

View File

@ -3201,11 +3201,14 @@ static BOOL IsCandidateMainStationPredicate(Entity *entity, void *parameter)
co_amount = [self getRandomAmountOfCommodity:co_type]; co_amount = [self getRandomAmountOfCommodity:co_type];
ShipEntity* special_container = [self newShipWithRole: [self symbolicNameForCommodity:co_type]]; if (randf() < 0.5) // only half of the time to prevent an oxp from monopolising a pod for a commodity.
if (special_container)
{ {
[container release]; ShipEntity* special_container = [self newShipWithRole: [self symbolicNameForCommodity:co_type]];
container = special_container; if (special_container)
{
[container release];
container = special_container;
}
} }
} }
@ -3213,7 +3216,7 @@ static BOOL IsCandidateMainStationPredicate(Entity *entity, void *parameter)
if (container != nil) if (container != nil)
{ {
[container setScanClass: CLASS_CARGO]; [container setScanClass: CLASS_CARGO];
if ([container cargoType] != CARGO_SCRIPTED_ITEM) [container setCommodity:co_type andAmount:co_amount]; [container setCommodity:co_type andAmount:co_amount];
[accumulator addObject:container]; [accumulator addObject:container];
[container release]; // released [container release]; // released
} }
@ -3249,7 +3252,7 @@ static BOOL IsCandidateMainStationPredicate(Entity *entity, void *parameter)
if (container) if (container)
{ {
[container setScanClass: CLASS_CARGO]; [container setScanClass: CLASS_CARGO];
if ([container cargoType] != CARGO_SCRIPTED_ITEM) [container setCommodity:commodity_type andAmount:amount]; [container setCommodity:commodity_type andAmount:amount];
[accumulator addObject:container]; [accumulator addObject:container];
[container release]; [container release];
} }
@ -4689,7 +4692,7 @@ static BOOL MaintainLinkedLists(Universe* uni)
{ {
/* /*
// EW 23-4-2002: Below used to be a test for: e2->actual_radius with Oolite 1.65. // EW 23-4-2010: Below used to be a test for: e2->actual_radius with Oolite 1.65.
// With e2->collision_radius it is now just duplicating the test above. // With e2->collision_radius it is now just duplicating the test above.
// Remove the code or use something smaller to check (if possible). // Remove the code or use something smaller to check (if possible).