MCPcopy Create free account
hub / github.com/JACoders/OpenJK / SV_AddEntToSnapshot

Function SV_AddEntToSnapshot

code/server/sv_snapshot.cpp:257–276  ·  view source on GitHub ↗

=============== SV_AddEntToSnapshot =============== */

Source from the content-addressed store, hash-verified

255===============
256*/
257static void SV_AddEntToSnapshot( svEntity_t *svEnt, gentity_t *gEnt, snapshotEntityNumbers_t *eNums ) {
258 // if we have already added this entity to this snapshot, don't add again
259 if ( svEnt->snapshotCounter == sv.snapshotCounter ) {
260 return;
261 }
262 svEnt->snapshotCounter = sv.snapshotCounter;
263
264 // if we are full, silently discard entities
265 if ( eNums->numSnapshotEntities == MAX_SNAPSHOT_ENTITIES ) {
266 return;
267 }
268
269 if (sv.snapshotCounter &1 && eNums->numSnapshotEntities == svs.numSnapshotEntities-1)
270 { //we're full, and about to wrap around and stomp ents, so half the time send the first set without stomping.
271 return;
272 }
273
274 eNums->snapshotEntities[ eNums->numSnapshotEntities ] = gEnt->s.number;
275 eNums->numSnapshotEntities++;
276}
277
278//rww - bg_public.h won't cooperate in here
279#define EF_PERMANENT 0x00080000

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected