Fixed fractional resources showing up in the GUI

This was SVN commit r7831.
This commit is contained in:
WhiteTreePaladin 2010-08-01 00:33:20 +00:00
parent cad0baed3c
commit dd2fcad2a2
3 changed files with 2 additions and 13 deletions

View File

@ -89,7 +89,7 @@ function displayGeneralInfo(playerState, entState, template)
// Resource stats
if (entState.resourceSupply)
{
var resources = entState.resourceSupply.amount + "/" + entState.resourceSupply.max + " ";
var resources = Math.ceil(+entState.resourceSupply.amount) + "/" + entState.resourceSupply.max + " ";
var resourceType = entState.resourceSupply.type["generic"];
getGUIObjectByName("sdResourceStats").caption = resources;

View File

@ -168,17 +168,6 @@ function updatePlayerDisplay(simState)
// Utility functions
//-------------------------------- -------------------------------- --------------------------------
function ceiling(number)
{
var integer = parseInt(number);
var remainder = number - integer;
if (remainder != 0)
integer++;
return integer;
}
function toTitleCase(string)
{
if (string.length > 0)

View File

@ -134,7 +134,7 @@ function setupUnitPanel(guiName, usedPanels, unitEntState, items, callback)
// Position the visible buttons (TODO: if there's lots, maybe they should be squeezed together to fit)
var numButtons = i;
var rowLength = 8;
var numRows = ceiling(numButtons / rowLength);
var numRows = Math.ceil(numButtons / rowLength);
var buttonSideLength = getGUIObjectByName("unit"+guiName+"Button[0]").size.bottom;
var buttonSpacer = ((guiName == "Selection")? buttonSideLength+1 : buttonSideLength+2);