- bugfix from tomreyn's stacktrace for resource selection

This commit is contained in:
Mark Vejvoda 2012-11-14 23:42:12 +00:00
parent 66ea587b7f
commit 490c538086

View File

@ -5245,7 +5245,7 @@ void Renderer::renderSelectionEffects() {
for(int i=0; i<selection->getCount(); ++i){
const Unit *unit= selection->getUnit(i);
if(unit != NULL) {
//translate
Vec3f currVec= unit->getCurrVectorFlat();
currVec.y+= 0.3f;
@ -5323,10 +5323,10 @@ void Renderer::renderSelectionEffects() {
}
}
}
}
if(selectedResourceObject!=NULL && selection->getCount()<1)
{
}
if(selectedResourceObject != NULL && selectedResourceObject->getResource() != NULL && selection->getCount() < 1) {
Resource *r= selectedResourceObject->getResource();
int defaultValue= r->getType()->getDefResPerPatch();
float colorValue=static_cast<float>(r->getAmount())/static_cast<float>(defaultValue);
@ -5336,7 +5336,7 @@ void Renderer::renderSelectionEffects() {
//target arrow
if(selection->getCount() == 1) {
const Unit *unit= selection->getUnit(0);
if(unit != NULL) {
//comand arrow
if(focusArrows && unit->anyCommand()) {
const CommandType *ct= unit->getCurrCommand()->getCommandType();
@ -5382,12 +5382,11 @@ void Renderer::renderSelectionEffects() {
Vec3f arrowTarget= Vec3f(pos.x, map->getCell(pos)->getHeight(), pos.y);
renderArrow(unit->getCurrVectorFlat(), arrowTarget, Vec3f(0.f, 0.f, 1.f), 0.3f);
}
}
}
//render selection hightlights
if(game->getGui()->getHighlightedUnit()!=NULL)
{
if(game->getGui()->getHighlightedUnit() != NULL) {
const Unit *unit=game->getGui()->getHighlightedUnit() ;
if(unit->isHighlighted()) {
@ -5425,11 +5424,9 @@ void Renderer::renderSelectionEffects() {
// }
// }
//render resource selection highlight
if(game->getGui()->getHighlightedResourceObject()!=NULL)
{
if(game->getGui()->getHighlightedResourceObject() != NULL) {
const Object* object=game->getGui()->getHighlightedResourceObject();
if(object->isHighlighted())
{
if(object->isHighlighted()) {
float highlight= object->getHightlight();
glColor4f(0.1f, 0.1f , 1.0f, highlight);
Vec3f v= object->getPos();