Fixed bug where station.shipyard generated shipyard when hasShipyard was false (#332)

This commit is contained in:
phkb 2019-04-19 19:09:13 +10:00 committed by AnotherCommander
parent 5f8a8ff80b
commit 8cad99b852

View File

@ -307,10 +307,18 @@ static JSBool StationGetProperty(JSContext *context, JSObject *this, jsid propID
return YES;
case kStation_shipyard:
{
if (![entity hasShipyard])
{
// return null if station has no shipyard
*value = OOJSValueFromNativeObject(context, nil);
}
else
{
if ([entity localShipyard] == nil) [entity generateShipyard];
NSMutableArray *shipyard = [entity localShipyard];
*value = OOJSValueFromNativeObject(context, shipyard);
}
return YES;
}