mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2025-02-18 01:41:59 +00:00
fixed read-only CVar registration keeping the existing value
This commit is contained in:
parent
c8c9bef131
commit
be0746dfc4
5 changed files with 19 additions and 4 deletions
|
@ -77,6 +77,8 @@ chg: with r_backend GL3, depth fade with MSAA now requires GLSL 4.00 at a minimu
|
||||||
|
|
||||||
chg: with r_backend GL3, alpha to coverage now requires GLSL 4.00 at a minimum
|
chg: with r_backend GL3, alpha to coverage now requires GLSL 4.00 at a minimum
|
||||||
|
|
||||||
|
fix: registration of a read-only CVar would keep the existing value
|
||||||
|
|
||||||
fix: the Direct3D projection transform didn't perfectly match the OpenGL version
|
fix: the Direct3D projection transform didn't perfectly match the OpenGL version
|
||||||
|
|
||||||
fix: /video was writing incorrect audio stream lengths to the .avi file headers
|
fix: /video was writing incorrect audio stream lengths to the .avi file headers
|
||||||
|
|
|
@ -452,7 +452,7 @@ void Com_StartupVariable( const char *match )
|
||||||
if ( !match || !strcmp( s, match ) ) {
|
if ( !match || !strcmp( s, match ) ) {
|
||||||
Cvar_Set( s, Cmd_Argv(2) );
|
Cvar_Set( s, Cmd_Argv(2) );
|
||||||
cvar_t* cv = Cvar_Get( s, "", 0 );
|
cvar_t* cv = Cvar_Get( s, "", 0 );
|
||||||
cv->flags |= CVAR_USER_CREATED;
|
cv->flags |= CVAR_USER_CREATED | CVAR_CMDLINE_CREATED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -422,7 +422,10 @@ cvar_t* Cvar_Get( const char *var_name, const char *var_value, int flags )
|
||||||
cvar_modifiedFlags |= flags;
|
cvar_modifiedFlags |= flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const qbool cmdLineCreated = (var->flags & CVAR_CMDLINE_CREATED) != 0;
|
||||||
var->flags |= flags;
|
var->flags |= flags;
|
||||||
|
var->flags &= ~CVAR_CMDLINE_CREATED;
|
||||||
|
|
||||||
// only allow one non-empty reset string without a warning
|
// only allow one non-empty reset string without a warning
|
||||||
// KHB 071110 no, that's wrong for several reasons, notably vm changes caused by pure
|
// KHB 071110 no, that's wrong for several reasons, notably vm changes caused by pure
|
||||||
if ((flags & CVAR_ROM) || !var->resetString[0]) {
|
if ((flags & CVAR_ROM) || !var->resetString[0]) {
|
||||||
|
@ -443,6 +446,12 @@ cvar_t* Cvar_Get( const char *var_name, const char *var_value, int flags )
|
||||||
Z_Free( s );
|
Z_Free( s );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CVAR_INIT doesn't allow CVar registration to override the command-line value
|
||||||
|
// (even if CVAR_ROM is also set)
|
||||||
|
if (cmdLineCreated && (flags & CVAR_INIT) != 0) {
|
||||||
|
return var;
|
||||||
|
}
|
||||||
|
|
||||||
/* KHB note that this is #if 0'd in the 132 code, but is actually REQUIRED for correctness
|
/* KHB note that this is #if 0'd in the 132 code, but is actually REQUIRED for correctness
|
||||||
consider a cgame that sets a CVAR_ROM client version:
|
consider a cgame that sets a CVAR_ROM client version:
|
||||||
you connect to a v1 server, load the v1 cgame, and set the ROM version to v1
|
you connect to a v1 server, load the v1 cgame, and set the ROM version to v1
|
||||||
|
@ -452,11 +461,13 @@ cvar_t* Cvar_Get( const char *var_name, const char *var_value, int flags )
|
||||||
i'm preserving this incorrect behavior FOR NOW for compatability, because
|
i'm preserving this incorrect behavior FOR NOW for compatability, because
|
||||||
game\ai_main.c(1352): trap_Cvar_Register( &mapname, "mapname", "", CVAR_SERVERINFO | CVAR_ROM );
|
game\ai_main.c(1352): trap_Cvar_Register( &mapname, "mapname", "", CVAR_SERVERINFO | CVAR_ROM );
|
||||||
breaks every single mod except CPMA otherwise, but it IS wrong, and critically so
|
breaks every single mod except CPMA otherwise, but it IS wrong, and critically so
|
||||||
|
myT: we don't care about other mods and keeping it broken is not acceptable at all
|
||||||
|
*/
|
||||||
// CVAR_ROM always overrides
|
// CVAR_ROM always overrides
|
||||||
if (flags & CVAR_ROM) {
|
if (flags & CVAR_ROM) {
|
||||||
Cvar_Set2( var_name, var_value, qtrue );
|
Cvar_Set2( var_name, var_value, qtrue );
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -662,7 +662,9 @@ default values.
|
||||||
#define CVAR_CHEAT 512 // can not be changed if cheats are disabled
|
#define CVAR_CHEAT 512 // can not be changed if cheats are disabled
|
||||||
#define CVAR_NORESTART 1024 // do not clear when a cvar_restart is issued
|
#define CVAR_NORESTART 1024 // do not clear when a cvar_restart is issued
|
||||||
|
|
||||||
#define CVAR_SERVER_CREATED 2048 // cvar was created by a server the client connected to.
|
#define CVAR_SERVER_CREATED 2048 // cvar was created by a server the client connected to
|
||||||
|
#define CVAR_CMDLINE_CREATED 4096 // cvar was created through the command-line (+set)
|
||||||
|
|
||||||
#define CVAR_NONEXISTENT 0xFFFFFFFF // Cvar doesn't exist.
|
#define CVAR_NONEXISTENT 0xFFFFFFFF // Cvar doesn't exist.
|
||||||
|
|
||||||
#define MAX_CVAR_VALUE_STRING 256
|
#define MAX_CVAR_VALUE_STRING 256
|
||||||
|
|
|
@ -547,7 +547,7 @@ static const cvarTableItem_t sv_cvars[] =
|
||||||
// systeminfo vars
|
// systeminfo vars
|
||||||
{ NULL, "sv_cheats", "0", CVAR_SYSTEMINFO | CVAR_ROM, CVART_BOOL, NULL, NULL, "enables cheat commands and changing cheat cvars" },
|
{ NULL, "sv_cheats", "0", CVAR_SYSTEMINFO | CVAR_ROM, CVART_BOOL, NULL, NULL, "enables cheat commands and changing cheat cvars" },
|
||||||
{ &sv_serverid, "sv_serverid", "0", CVAR_SYSTEMINFO | CVAR_ROM, CVART_INTEGER, NULL, NULL, "server session identifier" },
|
{ &sv_serverid, "sv_serverid", "0", CVAR_SYSTEMINFO | CVAR_ROM, CVART_INTEGER, NULL, NULL, "server session identifier" },
|
||||||
{ &sv_pure, "sv_pure", SV_PURE_DEFAULT, CVAR_SYSTEMINFO | CVAR_ROM, CVART_BOOL, NULL, NULL, "disables native code and forces client pk3s to match the server's" },
|
{ &sv_pure, "sv_pure", SV_PURE_DEFAULT, CVAR_SYSTEMINFO | CVAR_ROM | CVAR_INIT, CVART_BOOL, NULL, NULL, "disables native code and forces client pk3s to match the server's" },
|
||||||
{ NULL, "sv_paks", "", CVAR_SYSTEMINFO | CVAR_ROM, CVART_STRING, NULL, NULL, "checksums of the paks you're allowed to load data from" },
|
{ NULL, "sv_paks", "", CVAR_SYSTEMINFO | CVAR_ROM, CVART_STRING, NULL, NULL, "checksums of the paks you're allowed to load data from" },
|
||||||
{ NULL, "sv_pakNames", "", CVAR_SYSTEMINFO | CVAR_ROM, CVART_STRING, NULL, NULL, "names of the paks you're allowed to load data from" },
|
{ NULL, "sv_pakNames", "", CVAR_SYSTEMINFO | CVAR_ROM, CVART_STRING, NULL, NULL, "names of the paks you're allowed to load data from" },
|
||||||
{ NULL, "sv_referencedPaks", "", CVAR_SYSTEMINFO | CVAR_ROM, CVART_STRING, NULL, NULL, "checksums of the paks you might need to download" },
|
{ NULL, "sv_referencedPaks", "", CVAR_SYSTEMINFO | CVAR_ROM, CVART_STRING, NULL, NULL, "checksums of the paks you might need to download" },
|
||||||
|
|
Loading…
Reference in a new issue