MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / SetCVarFloat

Function SetCVarFloat

Descent3/dedicated_server.cpp:523–548  ·  view source on GitHub ↗

Sets the value for a cvar FLOAT type

Source from the content-addressed store, hash-verified

521
522// Sets the value for a cvar FLOAT type
523void SetCVarFloat(int index, float val) {
524 void *dest_variable;
525
526 if (CVars[index].type != CVAR_TYPE_FLOAT)
527 return; // Only handles ints
528
529 dest_variable = CVars[index].dest_variable;
530
531 if (!(CVars[index].var_min == -1 && CVars[index].var_max == -1)) {
532 if (val < CVars[index].var_min)
533 val = (float)CVars[index].var_min;
534
535 if (val > CVars[index].var_max)
536 val = (float)CVars[index].var_max;
537 }
538
539 if (dest_variable)
540 *((float *)dest_variable) = val;
541
542 // Do command specific stuff here
543 switch (index) {
544 case CVAR_AUDIOTAUNTDELAY:
545 MultiSetAudioTauntTime(val);
546 break;
547 }
548}
549// Sets the value for a cvar string type
550void SetCVarString(int index, const char *val) {
551 void *dest_variable;

Callers 1

SetCVarFunction · 0.85

Calls 1

MultiSetAudioTauntTimeFunction · 0.85

Tested by

no test coverage detected