- NPC missiles, backward compatibility part II: improved logging to avoid puzzling 'missile' is not a missile messages!
- system.addShips/addGroup: improved error messages. - comment cleanup. git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3255 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
2888f9bf40
commit
c0671a7dc9
@ -155,7 +155,7 @@ static GLfloat calcFuelChargeRate (GLfloat my_mass, GLfloat base_mass)
|
||||
- (BOOL) firePlasmaShotAtOffset:(double)offset speed:(double)speed color:(OOColor *)color direction:(OOViewID)direction;
|
||||
|
||||
// equipment
|
||||
- (OOEquipmentType *) generateEquipmentTypeFrom:(NSString *)role;
|
||||
- (OOEquipmentType *) generateMissileEquipmentTypeFrom:(NSString *)role;
|
||||
|
||||
@end
|
||||
|
||||
@ -2188,19 +2188,23 @@ ShipEntity* doOctreesCollide(ShipEntity* prime, ShipEntity* other)
|
||||
}
|
||||
|
||||
|
||||
- (OOEquipmentType *) generateEquipmentTypeFrom:(NSString *)role;
|
||||
- (OOEquipmentType *) generateMissileEquipmentTypeFrom:(NSString *)role;
|
||||
{
|
||||
/* The generated equipment type provides for backward compatibility with pre-1.74 OXPs missile_roles
|
||||
/* The generated missile equipment type provides for backward compatibility with pre-1.74 OXPs missile_roles
|
||||
and follows thiis template:
|
||||
|
||||
//NPC equipment, incompatible with player ship. Not buyable because of its TL.
|
||||
(
|
||||
100, 147500, "Shield Enhancers",
|
||||
"EQ_SHIELD_ENHANCER",
|
||||
"Shield enhancing technology dramatically increases the capability of standard defensive shields."
|
||||
100, 100000, "Missile",
|
||||
"EQ_X_MISSILE",
|
||||
"Unidentified Missile Type.",
|
||||
{
|
||||
is_external_store = true;
|
||||
}
|
||||
)
|
||||
*/
|
||||
NSArray *itemInfo = [NSArray arrayWithObjects:@"100",@"100000",@"Missile",role,@"Unknown Missile Type", nil];
|
||||
NSArray *itemInfo = [NSArray arrayWithObjects:@"100", @"100000", @"Missile", role, @"Unidentified Missile Type.",
|
||||
[NSDictionary dictionaryWithObjectsAndKeys: @"true", @"is_external_store", nil], nil];
|
||||
|
||||
[OOEquipmentType addEquipmentWithInfo:itemInfo];
|
||||
return [OOEquipmentType equipmentTypeWithIdentifier:role];
|
||||
@ -2312,7 +2316,6 @@ ShipEntity* doOctreesCollide(ShipEntity* prime, ShipEntity* other)
|
||||
}
|
||||
// end special cases
|
||||
|
||||
|
||||
if (_equipment == nil) _equipment = [[NSMutableSet alloc] init];
|
||||
|
||||
if ([equipmentKey isEqual:@"EQ_CARGO_BAY"])
|
||||
@ -2477,9 +2480,21 @@ ShipEntity* doOctreesCollide(ShipEntity* prime, ShipEntity* other)
|
||||
}
|
||||
|
||||
if (missileType == nil)
|
||||
{
|
||||
if ([role isEqualToString:@"missile"]) // no recognised eq_type found, let's use a unique identifier instead of the generic role 'missile'!
|
||||
{
|
||||
role = [missile name];
|
||||
missileType = [OOEquipmentType equipmentTypeWithIdentifier:role];
|
||||
if (missileType == nil)
|
||||
{
|
||||
OOLogWARN(@"ship.setUp.missiles", @"Missile '%@': no role with valid %@.plist entry found in shipdata.plist. Enabling compatibility mode using '%@' as its fallback equipment identifier.", role, @"equipment", role);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OOLogWARN(@"ship.setUp.missiles", @"missile_role '%@' used in ship '%@' needs a valid %@.plist entry.%@", role, [self name], @"equipment", @" Enabling compatibility mode.");
|
||||
missileType = [self generateEquipmentTypeFrom:role];
|
||||
}
|
||||
if (missileType == nil) missileType = [self generateMissileEquipmentTypeFrom:role];
|
||||
}
|
||||
[missile release];
|
||||
if ([missileType isMissileOrMine] || ([self isThargoid] && ([role hasPrefix:@"thargon"] || [role hasSuffix:@"thargon"])))
|
||||
|
@ -713,7 +713,7 @@ static JSBool SystemAddShips(JSContext *context, JSObject *this, uintN argc, jsv
|
||||
}
|
||||
if (!JS_ValueToInt32(context, argv[1], &count) || count < 1 || 64 < count)
|
||||
{
|
||||
OOReportJSError(context, @"System.%@(): expected %@, got '%@'.", func, @"positive count", [NSString stringWithJavaScriptValue:argv[1] inContext:context]);
|
||||
OOReportJSError(context, @"System.%@(): expected %@, got '%@'.", func, @"positive count no greater than 64", [NSString stringWithJavaScriptValue:argv[1] inContext:context]);
|
||||
return NO;
|
||||
}
|
||||
|
||||
@ -794,7 +794,7 @@ static JSBool SystemAddShipsToRoute(JSContext *context, JSObject *this, uintN ar
|
||||
}
|
||||
if (!JS_ValueToInt32(context, argv[1], &count) || count < 1 || 64 < count)
|
||||
{
|
||||
OOReportJSError(context, @"System.%@(): expected %@, got '%@'.", func, @"positive count", [NSString stringWithJavaScriptValue:argv[1] inContext:context]);
|
||||
OOReportJSError(context, @"System.%@(): expected %@, got '%@'.", func, @"positive count no greater than 64", [NSString stringWithJavaScriptValue:argv[1] inContext:context]);
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -8703,7 +8703,7 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context)
|
||||
[OOCharacter randomCharacterWithRole:@"police"
|
||||
andOriginalSystem: (randf() > 0.05)? systems[Ranrot() & 255]:system_seed]]];
|
||||
|
||||
[hunter_ship setPrimaryRole:@"police"]; // FIXME: do we actually need to change the ship's primary role? - Kaks 20091207
|
||||
[hunter_ship setPrimaryRole:@"police"]; // make sure interceptors are police...
|
||||
if ([hunter_ship scanClass] == CLASS_NOT_SET)
|
||||
[hunter_ship setScanClass: CLASS_POLICE];
|
||||
while (((Ranrot() & 7) + 2 < government)&&([hunter_ship pendingEscortCount] < 6))
|
||||
|
Loading…
x
Reference in New Issue
Block a user