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

Method SV_NextDownload_f

server/src/main/java/jake2/server/SV_USER.java:245–267  ·  view source on GitHub ↗
(List<String> args, GameImportsImpl gameImports, client_t client)

Source from the content-addressed store, hash-verified

243 * ================== SV_NextDownload_f ==================
244 */
245 private static void SV_NextDownload_f(List<String> args, GameImportsImpl gameImports, client_t client) {
246
247 if (client.download == null)
248 return;
249
250 int packet = client.downloadsize - client.downloadcount;
251 if (packet > 1024)
252 packet = 1024;
253
254 client.downloadcount += packet;
255 int size = client.downloadsize;
256 if (size == 0)
257 size = 1;
258 byte percent = (byte) (client.downloadcount * 100 / size);
259
260 byte[] data = new byte[packet];
261 System.arraycopy(client.download, client.downloadcount - packet, data, 0, packet);
262 client.netchan.reliablePending.add(new DownloadMessage(data, percent));
263
264 if (client.downloadcount == client.downloadsize) {
265 client.download = null;
266 }
267 }
268
269 /*
270 * ================== SV_BeginDownload_f ==================

Callers 1

SV_BeginDownload_fMethod · 0.95

Calls 1

addMethod · 0.45

Tested by

no test coverage detected