1
0
forked from 0ad/0ad

Fix two bugs in attack tooltips. Add an extra Math.round to ensure we don't get huge decimals, and use a building's default arrow count as a minimum in rate calculation.

This was SVN commit r14610.
This commit is contained in:
alpha123 2014-01-18 19:20:17 +00:00
parent ea526eedd1
commit c4643d925d
2 changed files with 4 additions and 4 deletions

View File

@ -221,7 +221,7 @@ function displaySingle(entState, template)
{
var realRange = entState.attack.elevationAdaptedRange;
var range = entState.attack.maxRange;
attack += ", [font=\"serif-bold-13\"]Range:[/font] " + range +
attack += ", [font=\"serif-bold-13\"]Range:[/font] " + Math.round(range) +
"[font=\"sans-10\"][color=\"orange\"] meters[/color][/font]";
if (Math.round(realRange - range) > 0)

View File

@ -183,9 +183,9 @@ function attackRateDetails(entState) {
var time = entState.attack.repeatTime / 1000;
if (entState.buildingAI) {
return arrows + "[font=\"sans-10\"][color=\"orange\"] " + pluralize("arrow", arrows) + "[/color][/font]" +
" / " + (time == 1 ? "" : time) + " [font=\"sans-10\"][color=\"orange\"]" + pluralize("second", time) +
"[/color][/font]";
return Math.max(arrows, entState.buildingAI.defaultArrowCount) + "[font=\"sans-10\"][color=\"orange\"] " +
pluralize("arrow", arrows) + "[/color][/font]" + " / " + (time == 1 ? "" : time) +
" [font=\"sans-10\"][color=\"orange\"]" + pluralize("second", time) + "[/color][/font]";
}
return time + "[font=\"sans-10\"][color=\"orange\"] " + pluralize("second", time) + "[/color][/font]";
}