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

Method StringToFilter

game/src/main/java/jake2/game/GameSVCmds.java:91–113  ·  view source on GitHub ↗

StringToFilter.

(String s, GameSVCmds.ipfilter_t f, GameExportsImpl gameExports)

Source from the content-addressed store, hash-verified

89 * StringToFilter.
90 */
91 static boolean StringToFilter(String s, GameSVCmds.ipfilter_t f, GameExportsImpl gameExports) {
92
93 byte b[] = { 0, 0, 0, 0 };
94 byte m[] = { 0, 0, 0, 0 };
95
96 try {
97 StringTokenizer tk = new StringTokenizer(s, ". ");
98
99 for (int n = 0; n < 4; n++) {
100 b[n] = (byte) Lib.atoi(tk.nextToken());
101 if (b[n] != 0)
102 m[n] = -1;
103 }
104
105 f.mask = ByteBuffer.wrap(m).getInt();
106 f.compare = ByteBuffer.wrap(b).getInt();
107 } catch (Exception e) {
108 gameExports.gameImports.cprintf(null, Defines.PRINT_HIGH, "Bad filter address: " + s + "\n");
109 return false;
110 }
111
112 return true;
113 }
114
115 /**
116 * SV_FilterPacket.

Callers 2

SVCmd_AddIP_fMethod · 0.95
SVCmd_RemoveIP_fMethod · 0.95

Calls 3

atoiMethod · 0.95
getIntMethod · 0.80
cprintfMethod · 0.65

Tested by

no test coverage detected