| 722 | } |
| 723 | |
| 724 | void setVariable(const char* name, const char* value) |
| 725 | { |
| 726 | char errorMsg[CSTR_LEN]; |
| 727 | |
| 728 | size_t count = s_var.size(); |
| 729 | for (size_t i = 0; i < count; i++) |
| 730 | { |
| 731 | if (s_var[i].name == name) |
| 732 | { |
| 733 | if (s_var[i].flags & CVFLAG_READ_ONLY) |
| 734 | { |
| 735 | sprintf(errorMsg, "Cannot change Read-Only variable \"%s\"", name); |
| 736 | s_history.push_back({ c_historyErrorColor, errorMsg }); |
| 737 | return; |
| 738 | } |
| 739 | setVariableValue(&s_var[i], value); |
| 740 | return; |
| 741 | } |
| 742 | } |
| 743 | |
| 744 | sprintf(errorMsg, "set - Unknown variable \"%s\"", name); |
| 745 | s_history.push_back({ c_historyErrorColor, errorMsg }); |
| 746 | } |
| 747 | |
| 748 | void getVariable(const char* name, char* value) |
| 749 | { |
no test coverage detected