MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Cvar_Update

Function Cvar_Update

code/qcommon/cvar.cpp:1313–1337  ·  view source on GitHub ↗

===================== Cvar_Update updates an interpreted modules' version of a cvar ===================== */

Source from the content-addressed store, hash-verified

1311=====================
1312*/
1313void Cvar_Update( vmCvar_t *vmCvar ) {
1314 cvar_t *cv = NULL;
1315 assert(vmCvar);
1316
1317 if ( (unsigned)vmCvar->handle >= (unsigned)cvar_numIndexes ) {
1318 Com_Error( ERR_DROP, "Cvar_Update: handle %u out of range", (unsigned)vmCvar->handle );
1319 }
1320
1321 cv = cvar_indexes + vmCvar->handle;
1322
1323 if ( cv->modificationCount == vmCvar->modificationCount ) {
1324 return;
1325 }
1326 if ( !cv->string ) {
1327 return; // variable might have been cleared by a cvar_restart
1328 }
1329 vmCvar->modificationCount = cv->modificationCount;
1330 if ( strlen(cv->string)+1 > MAX_CVAR_VALUE_STRING )
1331 Com_Error( ERR_DROP, "Cvar_Update: src %s length %u exceeds MAX_CVAR_VALUE_STRING",
1332 cv->string,
1333 (unsigned int) strlen(cv->string));
1334 Q_strncpyz( vmCvar->string, cv->string, MAX_CVAR_VALUE_STRING );
1335 vmCvar->value = cv->value;
1336 vmCvar->integer = cv->integer;
1337}
1338
1339/*
1340==================

Callers 5

Cvar_RegisterFunction · 0.70
CL_UISystemCallsFunction · 0.50
CL_CgameSystemCallsFunction · 0.50
UI_UpdateScreenshotFunction · 0.50
UI_UpdateCvarsFunction · 0.50

Calls 2

Q_strncpyzFunction · 0.85
Com_ErrorFunction · 0.70

Tested by

no test coverage detected