Fixes for scanner and weapon range issues in scripts (submitted by Kaks).

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1347 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2008-02-04 18:09:10 +00:00
parent 6894d2669e
commit 51d4b0f5c5
3 changed files with 9 additions and 1 deletions

View File

@ -678,6 +678,9 @@ static PlayerEntity *sSharedPlayer = nil;
port_weapon = [(NSNumber *)[dict objectForKey:@"port_weapon"] intValue];
if ([dict objectForKey:@"starboard_weapon"])
starboard_weapon = [(NSNumber *)[dict objectForKey:@"starboard_weapon"] intValue];
[self setWeaponDataFromType:forward_weapon];
scannerRange = SCANNER_MAX_RANGE;
missiles = [dict unsignedIntForKey:@"missiles"];
// sanity check the number of missiles...
@ -936,6 +939,8 @@ static PlayerEntity *sSharedPlayer = nil;
aft_weapon = WEAPON_NONE;
port_weapon = WEAPON_NONE;
starboard_weapon = WEAPON_NONE;
[self setWeaponDataFromType:forward_weapon];
scannerRange = SCANNER_MAX_RANGE;
max_cargo = 20; // will be reset later
@ -1052,6 +1057,8 @@ static PlayerEntity *sSharedPlayer = nil;
forward_weapon_type = StringToWeaponType([shipDict stringForKey:@"forward_weapon_type" defaultValue:@"WEAPON_NONE"]);
aft_weapon_type = StringToWeaponType([shipDict stringForKey:@"aft_weapon_type" defaultValue:@"WEAPON_NONE"]);
[self setWeaponDataFromType:forward_weapon_type];
scannerRange = SCANNER_MAX_RANGE;
missiles = [shipDict doubleForKey:@"missiles"];
has_ecm = [shipDict fuzzyBooleanForKey:@"has_ecm"];

View File

@ -162,6 +162,7 @@ static NSString * const kOOLogEntityBehaviourChanged = @"entity.behaviour.change
forward_weapon_type = StringToWeaponType([shipDict stringForKey:@"forward_weapon_type" defaultValue:@"WEAPON_NONE"]);
aft_weapon_type = StringToWeaponType([shipDict stringForKey:@"aft_weapon_type" defaultValue:@"WEAPON_NONE"]);
[self setWeaponDataFromType:forward_weapon_type];
weapon_energy = [shipDict floatForKey:@"weapon_energy"];
scannerRange = [shipDict floatForKey:@"scanner_range" defaultValue:25600.0];

View File

@ -326,7 +326,7 @@ static JSBool ShipGetProperty(JSContext *context, JSObject *this, jsval name, js
break;
case kShip_scannerRange:
JS_NewDoubleValue(context, [entity weaponRange], outValue);
JS_NewDoubleValue(context, [entity scannerRange], outValue);
break;
case kShip_reportAIMessages: