Applies +set cvar value commands, Adds command line parameters as script statements Commands lead with a +, and continue until another + 'set' commands are added early, so they are guaranteed to be set before the client and server initialize for the first time. Other commands are added l
(List<String> args, boolean clear)
| 96 | * @param clear - if true - remove such commands from 'args' |
| 97 | */ |
| 98 | public static void AddEarlySetCommands(List<String> args, boolean clear) { |
| 99 | for (int i = 0; i < args.size(); i++) { |
| 100 | if (!args.get(i).equals("+set") || args.size() < i + 2) |
| 101 | continue; |
| 102 | |
| 103 | // varName must not contain spaces |
| 104 | final String varName = args.get(i + 1); |
| 105 | |
| 106 | // value can contain spaces |
| 107 | final String value = args.get(i + 2); |
| 108 | |
| 109 | buffer.add("set " + varName + " \"" + value + '"'); |
| 110 | |
| 111 | if (clear) { |
| 112 | args.set(i, ""); |
| 113 | args.set(i + 1, ""); |
| 114 | args.set(i + 2, ""); |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * Adds command line parameters as script statements |