Sets the value for a cvar FLOAT type
| 521 | |
| 522 | // Sets the value for a cvar FLOAT type |
| 523 | void 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 |
| 550 | void SetCVarString(int index, const char *val) { |
| 551 | void *dest_variable; |
no test coverage detected