1
0
forked from 0ad/0ad

Fix my previous commit where if you had enough units buildings would never construct (rounding issue).

This was SVN commit r13268.
This commit is contained in:
wraitii 2013-03-12 10:07:53 +00:00
parent 791a901df9
commit 3f6702075b

View File

@ -247,7 +247,7 @@ Foundation.prototype.Build = function(builderEnt, work)
// Add an appropriate proportion of hitpoints
var cmpHealth = Engine.QueryInterface(this.entity, IID_Health);
var maxHealth = cmpHealth.GetMaxHitpoints();
var deltaHP = Math.max(0, Math.min(maxHealth, Math.floor(maxHealth * (amount * this.buildMultiplier))));
var deltaHP = Math.max(work, Math.min(maxHealth, Math.floor(maxHealth * (amount * this.buildMultiplier))));
if (deltaHP > 0)
{
cmpHealth.Increase(deltaHP);