MCPcopy Create free account
hub / github.com/demoth/jake2 / AddEarlySetCommands

Method AddEarlySetCommands

qcommon/src/main/java/jake2/qcommon/exec/Cbuf.java:98–117  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 3

InitMethod · 0.95
mainMethod · 0.95
reconfigureMethod · 0.95

Calls 5

sizeMethod · 0.80
equalsMethod · 0.45
getMethod · 0.45
addMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected