Fix for setting Entity.energy (submitted by Kaks on board).

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

View File

@ -14,6 +14,7 @@ No Sleep Nigel
Dylan Smith (winston)
David Taylor (dajt)
Eric Walch
Kaks
Library credits:

View File

@ -336,9 +336,10 @@ static JSBool EntitySetProperty(JSContext *context, JSObject *this, jsval name,
case kEntity_energy:
if (JS_ValueToNumber(context, *value, &fValue))
{
fValue == OOClamp_0_max_d(fValue, [entity maxEnergy]);
fValue = OOClamp_0_max_d(fValue, [entity maxEnergy]);
[entity setEnergy:fValue];
}
break;
default:
OOReportJavaScriptBadPropertySelector(context, @"Entity", JSVAL_TO_INT(name));