Skip to content

Commit 122734d

Browse files
committed
fix: cvarlist doesn't print float values
comparing the int value to the float value casted to int will pass every time. instead, copy over the logic from ConVar_PrintDescription which checks to see if the int value is equivalent to the float value
1 parent 72978c5 commit 122734d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/engine/cvar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ static void PrintCvar( const ConVar *var, bool logging, FileHandle_t& fh )
741741
char tempbuff[512] = { 0 };
742742

743743
// Clean up integers
744-
if ( var->GetInt() == (int)var->GetFloat() )
744+
if ( fabs( (float)var->GetInt() - var->GetFloat() ) < 0.000001 )
745745
{
746746
Q_snprintf(valstr, sizeof( valstr ), "%-8i", var->GetInt() );
747747
}

0 commit comments

Comments
 (0)