===================== Cvar_Update updates an interpreted modules' version of a cvar ===================== */
| 1311 | ===================== |
| 1312 | */ |
| 1313 | void 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 | ================== |
no test coverage detected