For consistency, replaced shipInternalDescription JavaScript method with shipDisplayName. Made shipDescription return the ship name, like it was before. I believe it is cleaner this way.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1369 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
d39e2d4149
commit
3d21ef4a20
@ -77,7 +77,7 @@ enum
|
||||
{
|
||||
// Property IDs
|
||||
kShip_shipDescription, // name, string, read-only
|
||||
kShip_shipInternalDescription, // internal name, string, read-only
|
||||
kShip_shipDisplayName, // name displayed on screen, string, read-only
|
||||
kShip_roles, // roles, array, read-only
|
||||
kShip_roleProbabilities, // roles and probabilities, dictionary, read-only
|
||||
kShip_primaryRole, // Primary role, string, read-only
|
||||
@ -153,7 +153,7 @@ static JSPropertySpec sShipProperties[] =
|
||||
{ "script", kShip_script, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||
{ "scriptInfo", kShip_scriptInfo, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||
{ "shipDescription", kShip_shipDescription, JSPROP_PERMANENT | JSPROP_ENUMERATE },
|
||||
{ "shipInternalDescription", kShip_shipInternalDescription, JSPROP_PERMANENT | JSPROP_ENUMERATE },
|
||||
{ "shipDisplayName", kShip_shipDisplayName, JSPROP_PERMANENT | JSPROP_ENUMERATE },
|
||||
{ "speed", kShip_speed, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||
{ "subEntities", kShip_subEntities, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||
{ "target", kShip_target, JSPROP_PERMANENT | JSPROP_ENUMERATE },
|
||||
@ -227,11 +227,11 @@ static JSBool ShipGetProperty(JSContext *context, JSObject *this, jsval name, js
|
||||
switch (JSVAL_TO_INT(name))
|
||||
{
|
||||
case kShip_shipDescription:
|
||||
result = [entity displayName];
|
||||
result = [entity name];
|
||||
break;
|
||||
|
||||
case kShip_shipInternalDescription:
|
||||
result = [entity name];
|
||||
case kShip_shipDisplayName:
|
||||
result = [entity displayName];
|
||||
break;
|
||||
|
||||
case kShip_roles:
|
||||
@ -411,18 +411,6 @@ static JSBool ShipSetProperty(JSContext *context, JSObject *this, jsval name, js
|
||||
switch (JSVAL_TO_INT(name))
|
||||
{
|
||||
case kShip_shipDescription:
|
||||
if (entity->isPlayer)
|
||||
{
|
||||
OOReportJavaScriptError(context, @"Ship.%@ [setter]: cannot set %@ for player.", @"displayName", @"displayName");
|
||||
}
|
||||
else
|
||||
{
|
||||
sValue = [NSString stringWithJavaScriptValue:*value inContext:context];
|
||||
if (sValue != nil) [entity setDisplayName:sValue];
|
||||
}
|
||||
break;
|
||||
|
||||
case kShip_shipInternalDescription:
|
||||
if (entity->isPlayer)
|
||||
{
|
||||
OOReportJavaScriptError(context, @"Ship.%@ [setter]: cannot set %@ for player.", @"name", @"name");
|
||||
@ -433,6 +421,18 @@ static JSBool ShipSetProperty(JSContext *context, JSObject *this, jsval name, js
|
||||
if (sValue != nil) [entity setName:sValue];
|
||||
}
|
||||
break;
|
||||
|
||||
case kShip_shipDisplayName:
|
||||
if (entity->isPlayer)
|
||||
{
|
||||
OOReportJavaScriptError(context, @"Ship.%@ [setter]: cannot set %@ for player.", @"displayName", @"displayName");
|
||||
}
|
||||
else
|
||||
{
|
||||
sValue = [NSString stringWithJavaScriptValue:*value inContext:context];
|
||||
if (sValue != nil) [entity setDisplayName:sValue];
|
||||
}
|
||||
break;
|
||||
|
||||
case kShip_primaryRole:
|
||||
if (entity->isPlayer)
|
||||
|
Loading…
x
Reference in New Issue
Block a user