From 126ed185890c7f89005b6852732e75fda90e502f Mon Sep 17 00:00:00 2001 From: SoftCoder Date: Fri, 28 Nov 2014 20:49:04 -0800 Subject: [PATCH] - bugfix selection circle and healthbar rendering --- source/glest_game/graphics/renderer.cpp | 26 +++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index 4a15b902..a2a37ef1 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -5464,19 +5464,21 @@ void Renderer::renderSelectionEffects(int healthbarMode) { currVec.y+= 0.3f; //selection circle - int finalHealthbarMode=hbvUndefined; - if(healthbarMode==hbvUndefined) { - finalHealthbarMode=unit->getFaction()->getType()->getHealthbarVisible(); - } else { - finalHealthbarMode=healthbarMode; + int finalHealthbarMode = hbvUndefined; + if(healthbarMode == hbvUndefined) { + finalHealthbarMode = unit->getFaction()->getType()->getHealthbarVisible(); } - bool healthbarsVisible=((finalHealthbarMode&hbvAlways)||(finalHealthbarMode&hbvSelected)||(finalHealthbarMode&hbvIfNeeded)); - float selectionCircleThickness=0.2f; - float hpRatio=unit->getHpRatio(); + else { + finalHealthbarMode = healthbarMode; + } + bool healthbarsVisible =((finalHealthbarMode & hbvAlways) || + (finalHealthbarMode & hbvSelected) || + (finalHealthbarMode & hbvIfNeeded)); + float selectionCircleThickness = 0.2f; + float hpRatio = unit->getHpRatio(); if(healthbarsVisible) { - //hpRatio=unit->getHpRatio(); - selectionCircleThickness=0.05f; - hpRatio=1.0f; + selectionCircleThickness = 0.05f; + hpRatio = 1.0f; } if(world->getThisFactionIndex() == unit->getFactionIndex()) { @@ -5493,7 +5495,7 @@ void Renderer::renderSelectionEffects(int healthbarMode) { else if ( world->getThisTeamIndex() == unit->getTeam()) { glColor4f(hpRatio, hpRatio, 0, 0.3f); } - else{ + else { glColor4f(hpRatio, 0, 0, 0.3f); } renderSelectionCircle(currVec, unit->getType()->getSize(), selectionCircleRadius,selectionCircleThickness);