Add support for non-integer GarrisonHolder regen rates; round health up in the GUI. Refs #1633.

This was SVN commit r12651.
This commit is contained in:
Deiz 2012-09-09 00:52:10 +00:00
parent 502311fe5c
commit 7d8ef7a2ef
2 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ GarrisonHolder.prototype.Schema =
"<ref name='nonNegativeDecimal'/>" +
"</element>" +
"<element name='BuffHeal' a:help='Number of hit points that will be restored to this holder&apos;s garrisoned units each second'>" +
"<data type='nonNegativeInteger'/>" +
"<ref name='nonNegativeDecimal'/>" +
"</element>" +
"<element name='LoadingRange' a:help='The maximum distance from this holder at which entities are allowed to garrison. Should be about 2.0 for land entities and preferably greater for ships'>" +
"<ref name='nonNegativeDecimal'/>" +

View File

@ -165,7 +165,7 @@ GuiInterface.prototype.GetEntityState = function(player, ent)
var cmpHealth = Engine.QueryInterface(ent, IID_Health);
if (cmpHealth)
{
ret.hitpoints = cmpHealth.GetHitpoints();
ret.hitpoints = Math.ceil(cmpHealth.GetHitpoints());
ret.maxHitpoints = cmpHealth.GetMaxHitpoints();
ret.needsRepair = cmpHealth.IsRepairable() && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints());
ret.needsHeal = !cmpHealth.IsUnhealable();