-
-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix isPlayerHudComponentVisible incompatible with command showhud
#1609
Conversation
Originally posted by @qaisjp in #547 (comment) If I understand correctly this pull request would make it impossible to know whether a component has been disabled by script or user. I think this is a negative side effect that must be solved before merge. Also, maybe allow getting |
Uhh.. maybe we can work on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree we can't merge the current version of this. I've explained why at #547 (comment).
Let's discuss the solution on #547 and we've settled on a solution you can implement it here if you want.
Here is the result: |
bool CStaticFunctionDefinitions::IsPlayerHudComponentVisible(eHudComponent component, bool& bOutIsVisible) | ||
bool CStaticFunctionDefinitions::IsPlayerHudComponentVisible(eHudComponent component, bool bOutIsEnabled, bool& bOutIsVisible) | ||
{ | ||
bOutIsVisible = g_pGame->GetHud()->IsComponentVisible(component); | ||
bOutIsVisible = g_pGame->GetHud()->IsComponentVisible(component, bOutIsEnabled); | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're modifying this function, it's probably better to remove it. We don't put code in CStaticFunctionDefinitions
anymore. You can call g_pGame->GetHud()->IsComponentVisible
directly. The rest of the PR looks okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had these two comments from a draft review ages ago, I guess I forgot to submit
@@ -1951,9 +1951,9 @@ bool CStaticFunctionDefinitions::ShowPlayerHudComponent(eHudComponent component, | |||
return true; | |||
} | |||
|
|||
bool CStaticFunctionDefinitions::IsPlayerHudComponentVisible(eHudComponent component, bool& bOutIsVisible) | |||
bool CStaticFunctionDefinitions::IsPlayerHudComponentVisible(eHudComponent component, bool bOutIsEnabled, bool& bOutIsVisible) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This, and elsewhere, should be bCheckEnabled
.
if (bOutIsEnabled) | ||
{ | ||
if (g_pCore->GetGame()->GetHud()->IsDisabled()) | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use if (bIsEnabled && ...->IsDisabled())
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah sure
This draft pull request is stale because it has been open for at least 90 days with no activity. Please continue on your draft pull request or it will be closed in 30 days automatically. |
This draft pull request was closed because it has been marked stale for 30 days with no activity. |
this should Fix #547 since the command
showhud
disables the hud andisPlayerHudComponentVisible
only checks if the component is visible so It makes no sense.This should be enough but feel free to say anything.