StringToFilter.
(String s, GameSVCmds.ipfilter_t f, GameExportsImpl gameExports)
| 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. |
no test coverage detected