From 9e3b4f4eb07c4eed1fc5275fefda26415c8a8ab1 Mon Sep 17 00:00:00 2001 From: Andrew Brindamour Date: Sun, 7 Aug 2016 16:18:03 -0700 Subject: [PATCH] WIP #12: Fix crash when node health changes to 100% --- .../artemis/engconsole/ui/damcon/InternalSelectable.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/brindyblitz/artemis/engconsole/ui/damcon/InternalSelectable.java b/src/com/brindyblitz/artemis/engconsole/ui/damcon/InternalSelectable.java index a935741..316f751 100644 --- a/src/com/brindyblitz/artemis/engconsole/ui/damcon/InternalSelectable.java +++ b/src/com/brindyblitz/artemis/engconsole/ui/damcon/InternalSelectable.java @@ -278,7 +278,7 @@ public void updateHealth(float pct) { this.healthPct = pct; - int texture_index = (int) (HEALTH_QUANTA * pct); + int texture_index = Math.min((int) (HEALTH_QUANTA * pct), HEALTH_QUANTA -1); standardTexture = nodeTypeToStandardColorizedTextures.get(this.selectableType)[texture_index]; hoveredTexture = nodeTypeToHoveredColorizedTextures.get(this.selectableType)[texture_index];