Fixed JS player.ship.manifest.list.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3936 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2010-12-31 14:51:00 +00:00
parent e4e34235da
commit 0730e00139

View File

@ -258,14 +258,10 @@ static JSBool ManifestGetProperty(OOJS_PROP_ARGS)
PlayerEntity *entity = OOPlayerForScripting();
unsigned commodity;
if (!GetCommodityID(propID, &commodity)) return YES;
if (GetCommodityID(propID, &commodity))
{
switch (commodity)
{
case kManifest_list:
result = [entity cargoListForScripting];
OK = YES;
break;
case kManifest_food:
*value = INT_TO_JSVAL([entity cargoQuantityForType:COMMODITY_FOOD]);
@ -357,9 +353,22 @@ static JSBool ManifestGetProperty(OOJS_PROP_ARGS)
*value = INT_TO_JSVAL([entity cargoQuantityForType:COMMODITY_ALIEN_ITEMS]);
OK = YES;
break;
}
}
else
{
if (!OOJS_PROPID_IS_INT) return YES;
switch (OOJS_PROPID_INT)
{
case kManifest_list:
result = [entity cargoListForScripting];
OK = YES;
break;
default:
OOReportJSBadPropertySelector(context, @"Manifest", commodity);
OOReportJSBadPropertySelector(context, @"Manifest", OOJS_PROPID_INT);
}
}
if (OK && result != nil) *value = [result javaScriptValueInContext:context];