mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2025-02-01 13:20:50 +00:00
fixed validation for ch_crosshairHitColor and ch_crosshairFragColor
This commit is contained in:
parent
457ca2ab65
commit
e83e2eb532
3 changed files with 10 additions and 5 deletions
|
@ -2440,11 +2440,11 @@ static const cvarTableItemCPMA_t cpma_cvars[] =
|
|||
"Crosshair text", CVARCAT_HUD, "Crosshair uses this text instead of an icon", ""
|
||||
},
|
||||
{
|
||||
"ch_crosshairHitColor", CVART_COLOR_CPMA,
|
||||
"ch_crosshairHitColor", CVART_COLOR_CPMA_E,
|
||||
"Crosshair hit color", CVARCAT_HUD, "", ""
|
||||
},
|
||||
{
|
||||
"ch_crosshairFragColor", CVART_COLOR_CPMA,
|
||||
"ch_crosshairFragColor", CVART_COLOR_CPMA_E,
|
||||
"Crosshair kill color", CVARCAT_HUD, "", ""
|
||||
},
|
||||
{
|
||||
|
|
|
@ -247,6 +247,9 @@ static qbool Cvar_IsValidValue( cvar_t *var, const char *value, qboolean printWa
|
|||
WARNING( "must be a single char" );
|
||||
if ( !IsCPMAColorCode(value[0]) )
|
||||
WARNING( "invalid color code, must be [a-zA-Z0-9]" );
|
||||
} else if ( var->type == CVART_COLOR_CPMA_E ) {
|
||||
if ( value[0] != '\0' && !IsCPMAColorCode(value[0]) )
|
||||
WARNING( "invalid color code, must be [a-zA-Z0-9] or empty" );
|
||||
} else if ( var->type == CVART_COLOR_CHBLS ) {
|
||||
if ( strlen(value) != 5 )
|
||||
WARNING( "must be 5 chars" );
|
||||
|
@ -640,6 +643,7 @@ void Cvar_SetDataType( const char* cvarName, cvarType_t type )
|
|||
Q_assert(
|
||||
type == CVART_STRING ||
|
||||
type == CVART_COLOR_CPMA ||
|
||||
type == CVART_COLOR_CPMA_E ||
|
||||
type == CVART_COLOR_CHBLS ||
|
||||
type == CVART_COLOR_RGB ||
|
||||
type == CVART_COLOR_RGBA );
|
||||
|
@ -826,10 +830,10 @@ void Cvar_PrintTypeAndRange( const char *var_name, printf_t print )
|
|||
print( "RGB" );
|
||||
} else if ( var->type == CVART_COLOR_RGBA ) {
|
||||
print( "RGBA" );
|
||||
} else if ( var->type == CVART_COLOR_CPMA ) {
|
||||
print( "color_code" );
|
||||
} else if ( var->type == CVART_COLOR_CPMA || var->type == CVART_COLOR_CPMA_E ) {
|
||||
print( "color code" );
|
||||
} else if ( var->type == CVART_COLOR_CHBLS ) {
|
||||
print( "color_CHBLS" );
|
||||
print( "CHBLS colors" );
|
||||
} else {
|
||||
print( "string" );
|
||||
}
|
||||
|
|
|
@ -698,6 +698,7 @@ typedef enum {
|
|||
CVART_BOOL, // uses integer min/max bounds, min=0 and max=1
|
||||
// extended data types (not currently used by the CPMA QVMs)
|
||||
CVART_COLOR_CPMA, // CPMA color code (0-9 A-Z a-z)
|
||||
CVART_COLOR_CPMA_E, // CPMA color code or empty
|
||||
CVART_COLOR_CHBLS, // CPMA color codes: rail Core, Head, Body, Legs, rail Spiral
|
||||
CVART_COLOR_RGB, // as hex, e.g. FF00FF
|
||||
CVART_COLOR_RGBA, // as hex, e.g. FF00FF00
|
||||
|
|
Loading…
Reference in a new issue