Open
Conversation
This also will fix weapons that only use bpammo (gauss, egon, snarks, etc.)
|
CHud::GetHudAmmoColor may cause "Integer division by zero" exception if maxvalue = 0 for whatever reason. Although I have no idea how to reproduce it (it happened on one particular server when dropping all weapons), I have received a crash report with that error. diff --git a/cl_dll/CHud.cpp b/cl_dll/CHud.cpp
index de1a1cd..f74a385 100644
--- a/cl_dll/CHud.cpp
+++ b/cl_dll/CHud.cpp
@@ -1037,7 +1037,7 @@ void CHud::GetHudColor( int hudPart, int value, int &r, int &g, int &b )
void CHud::GetHudAmmoColor(int value, int maxvalue, int &r, int &g, int &b)
{
RGBA *c;
- if (maxvalue == -1) // if you are using custom weapons, then default colors are going to be used....
+ if (maxvalue == -1 || maxvalue == 0) // if you are using custom weapons, then default colors are going to be used....
{
ParseColor(m_pCvarColor->string, m_hudColor); c = &m_hudColor;
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Info
It will color ammo depending on how much you have.
Fixed
Screens