MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / Set

Method Set

neo/framework/CVarSystem.cpp:309–357  ·  view source on GitHub ↗

============ idInternalCVar::Set ============ */

Source from the content-addressed store, hash-verified

307============
308*/
309void idInternalCVar::Set( const char *newValue, bool force, bool fromServer ) {
310 if ( session && session->IsMultiplayer() && !fromServer ) {
311#ifndef ID_TYPEINFO
312 if ( ( flags & CVAR_NETWORKSYNC ) && idAsyncNetwork::client.IsActive() ) {
313 common->Printf( "%s is a synced over the network and cannot be changed on a multiplayer client.\n", nameString.c_str() );
314#if ID_ALLOW_CHEATS
315 common->Printf( "ID_ALLOW_CHEATS override!\n" );
316#else
317 return;
318#endif
319 }
320#endif
321 if ( ( flags & CVAR_CHEAT ) && !cvarSystem->GetCVarBool( "net_allowCheats" ) ) {
322 common->Printf( "%s cannot be changed in multiplayer.\n", nameString.c_str() );
323#if ID_ALLOW_CHEATS
324 common->Printf( "ID_ALLOW_CHEATS override!\n" );
325#else
326 return;
327#endif
328 }
329 }
330
331 if ( !newValue ) {
332 newValue = resetString.c_str();
333 }
334
335 if ( !force ) {
336 if ( flags & CVAR_ROM ) {
337 common->Printf( "%s is read only.\n", nameString.c_str() );
338 return;
339 }
340
341 if ( flags & CVAR_INIT ) {
342 common->Printf( "%s is write protected.\n", nameString.c_str() );
343 return;
344 }
345 }
346
347 if ( valueString.Icmp( newValue ) == 0 ) {
348 return;
349 }
350
351 valueString = newValue;
352 value = valueString.c_str();
353 UpdateValue();
354
355 SetModified();
356 cvarSystem->SetModifiedFlags( flags );
357}
358
359/*
360============

Callers 15

StartNewGameMethod · 0.45
MoveToNewMapMethod · 0.45
LoadGameMethod · 0.45
RunGameTicMethod · 0.45
ReadDictMethod · 0.45
CommandMethod · 0.45
ResetFlaggedVariablesMethod · 0.45
MoveCVarsToDictMethod · 0.45
Toggle_fMethod · 0.45
LoadMapLocalizeDataFunction · 0.45
LocalizeMapFunction · 0.45

Calls 7

IsMultiplayerMethod · 0.80
GetCVarBoolMethod · 0.80
SetModifiedFlagsMethod · 0.80
IcmpMethod · 0.60
IsActiveMethod · 0.45
PrintfMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected