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

Method SV_FindIndex

server/src/main/java/jake2/server/SV_GAME.java:217–236  ·  view source on GitHub ↗

Find an index of a configstring with `val` value, or create a new one.

(String val, int start, int max, boolean create)

Source from the content-addressed store, hash-verified

215 * Find an index of a configstring with `val` value, or create a new one.
216 */
217 int SV_FindIndex(String val, int start, int max, boolean create) {
218 int i;
219
220 if (val == null || val.length() == 0)
221 return 0;
222
223 for (i = 1; i < max && gameImports.sv.configstrings[start + i] != null; i++)
224 if (val.equals(gameImports.sv.configstrings[start + i]))
225 return i;
226
227 if (!create)
228 return 0;
229
230 if (i == max)
231 Com.Error(Defines.ERR_DROP, "*Index: overflow");
232
233 PF_Configstring(start + i, val);
234
235 return i;
236 }
237
238 /**
239 * SV_CreateBaseline

Callers 4

PF_setmodelMethod · 0.95
modelindexMethod · 0.80
soundindexMethod · 0.80
imageindexMethod · 0.80

Calls 3

ErrorMethod · 0.95
PF_ConfigstringMethod · 0.95
equalsMethod · 0.45

Tested by

no test coverage detected