radardotsTooltip.patch (2,453 bytes)
2006-06-12 16:12
Index: Game/UI/MouseHandler.cpp
===================================================================
--- Game/UI/MouseHandler.cpp (revision 1460)
+++ rts/Game/UI/MouseHandler.cpp (working copy)
@@ -13,6 +13,7 @@
#include "Game/SelectedUnits.h"
#include "Sim/Units/Unit.h"
#include "Sim/Misc/Feature.h"
+#include "Sim/Misc/LosHandler.h"
#include "Game/Team.h"
#include "InfoConsole.h"
#include "MiniMap.h"
@@ -553,21 +554,25 @@
feature=0;
if(unit){
- // show the player name instead of unit name if it has FBI tag showPlayerName
- if(unit->unitDef->showPlayerName)
- {
- s=gs->players[gs->Team(unit->team)->leader]->playerName.c_str();
- } else {
- s=unit->tooltip;
- }
- // don't show the unit health and other info if it has FBI tag hideDamage and isn't on our team
- if(!(unit->unitDef->hideDamage && unit->team != gu->myTeam))
- {
- char tmp[500];
- sprintf(tmp,"\nHealth %.0f/%.0f \nExperience %.2f Cost %.0f Range %.0f \n\xff\xd3\xdb\xffMetal: \xff\x50\xff\x50%.1f\xff\x90\x90\x90/\xff\xff\x50\x01-%.1f\xff\xd3\xdb\xff Energy: \xff\x50\xff\x50%.1f\xff\x90\x90\x90/\xff\xff\x50\x01-%.1f",
- unit->health,unit->maxHealth,unit->experience,unit->metalCost+unit->energyCost/60,unit->maxRange, unit->metalMake, unit->metalUse, unit->energyMake, unit->energyUse);
- s+=tmp;
- }
+ // don't show the tooltip if it's a radar dot
+ if(!gu->spectating && gs->AllyTeam(unit->team) != gu->myAllyTeam && !loshandler->InLos(unit,gu->myAllyTeam)){
+ return "Enemy unit";
+ }
+ // show the player name instead of unit name if it has FBI tag showPlayerName
+ if(unit->unitDef->showPlayerName)
+ {
+ s=gs->players[gs->Team(unit->team)->leader]->playerName.c_str();
+ } else {
+ s=unit->tooltip;
+ }
+ // don't show the unit health and other info if it has FBI tag hideDamage and isn't on our ally team
+ if(!(!gu->spectating && unit->unitDef->hideDamage && gs->AllyTeam(unit->team) != gu->myAllyTeam))
+ {
+ char tmp[500];
+ sprintf(tmp,"\nHealth %.0f/%.0f \nExperience %.2f Cost %.0f Range %.0f \n\xff\xd3\xdb\xffMetal: \xff\x50\xff\x50%.1f\xff\x90\x90\x90/\xff\xff\x50\x01-%.1f\xff\xd3\xdb\xff Energy: \xff\x50\xff\x50%.1f\xff\x90\x90\x90/\xff\xff\x50\x01-%.1f",
+ unit->health,unit->maxHealth,unit->experience,unit->metalCost+unit->energyCost/60,unit->maxRange, unit->metalMake, unit->metalUse, unit->energyMake, unit->energyUse);
+ s+=tmp;
+ }
return s;
}
if(feature){