mirror of
https://github.com/ENSL/NS.git
synced 2024-11-24 21:41:17 +00:00
Prevent duplicate tooltips appearing on screen
Tooltips will no longer be added to the screen if that message is already being displayed. This prevents the same message (e.g. the ready room F4 message) from appearing multiple times if the player keeps pressing F4.
This commit is contained in:
parent
f9a8db4963
commit
eb91c70a75
2 changed files with 13 additions and 1 deletions
|
@ -554,9 +554,20 @@ void AvHHud::AddTooltip(const char* inMessageText, bool inIsToolTip, float inToo
|
|||
{
|
||||
if(gEngfuncs.pfnGetCvarFloat(kvAutoHelp) || !inIsToolTip)
|
||||
{
|
||||
string theNewMessage = string(inMessageText);
|
||||
|
||||
// Don't add the tool tip if it is already on screen
|
||||
for (AvHTooltip tip : mTooltips)
|
||||
{
|
||||
if (tip.GetText() == theNewMessage)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AvHTooltip theNewTooltip;
|
||||
|
||||
theNewTooltip.SetText(string(inMessageText));
|
||||
theNewTooltip.SetText(theNewMessage);
|
||||
theNewTooltip.SetNormalizedScreenX(1.0f - inTooltipWidth - kHelpMessageLeftEdgeInset);
|
||||
theNewTooltip.SetNormalizedScreenY(0.01f);
|
||||
theNewTooltip.SetCentered(false);
|
||||
|
|
|
@ -77,6 +77,7 @@ public:
|
|||
void SetBoldR(int inR);
|
||||
void SetBoldG(int inG);
|
||||
void SetBoldB(int inB);
|
||||
string GetText() { return mText; }
|
||||
|
||||
private:
|
||||
bool ChopStringOfMaxScreenWidth(int inMaxScreenWidth, string& ioBaseString, string& outChoppedString);
|
||||
|
|
Loading…
Reference in a new issue