MCPcopy Create free account
hub / github.com/assaultcube/AC / readdemo

Function readdemo

source/src/server.cpp:1256–1286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1254}
1255
1256void readdemo()
1257{
1258 if(!demoplayback) return;
1259 while(sg->gamemillis >= nextplayback)
1260 {
1261 int chan, len;
1262 if(demoplayback->read(&chan, sizeof(chan))!=sizeof(chan) ||
1263 demoplayback->read(&len, sizeof(len))!=sizeof(len))
1264 {
1265 enddemoplayback();
1266 return;
1267 }
1268 lilswap(&chan, 1);
1269 lilswap(&len, 1);
1270 ENetPacket *packet = enet_packet_create(NULL, len, 0);
1271 if(!packet || demoplayback->read(packet->data, len)!=len)
1272 {
1273 if(packet) enet_packet_destroy(packet);
1274 enddemoplayback();
1275 return;
1276 }
1277 sendpacket(-1, chan, packet, -1, true);
1278 if(!packet->referenceCount) enet_packet_destroy(packet);
1279 if(demoplayback->read(&nextplayback, sizeof(nextplayback))!=sizeof(nextplayback))
1280 {
1281 enddemoplayback();
1282 return;
1283 }
1284 lilswap(&nextplayback, 1);
1285 }
1286}
1287
1288void putflaginfo(packetbuf &p, int flag)
1289{

Callers 1

serversliceFunction · 0.85

Calls 6

enddemoplaybackFunction · 0.85
lilswapFunction · 0.85
enet_packet_createFunction · 0.85
enet_packet_destroyFunction · 0.85
sendpacketFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected