MCPcopy Create free account
hub / github.com/ZDoom/Raze / StaticReadRNGState

Method StaticReadRNGState

source/common/engine/m_random.cpp:314–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312//==========================================================================
313
314void FRandom::StaticReadRNGState(FSerializer &arc)
315{
316 FRandom *rng;
317
318 arc("rngseed", rngseed);
319
320 // Call StaticClearRandom in order to ensure that SFMT is initialized
321 FRandom::StaticClearRandom ();
322
323 if (arc.BeginArray("rngs"))
324 {
325 int count = arc.ArraySize();
326
327 for (int i = 0; i < count; i++)
328 {
329 if (arc.BeginObject(nullptr))
330 {
331 uint32_t crc;
332 arc("crc", crc);
333
334 for (rng = FRandom::RNGList; rng != NULL; rng = rng->Next)
335 {
336 if (rng->NameCRC == crc)
337 {
338 arc("index", rng->idx)
339 .Array("u", rng->sfmt.u, SFMT::N32);
340 break;
341 }
342 }
343 arc.EndObject();
344 }
345 }
346 arc.EndArray();
347 }
348}
349
350//==========================================================================
351//

Callers

nothing calls this directly

Calls 5

ArraySizeMethod · 0.80
BeginArrayMethod · 0.45
BeginObjectMethod · 0.45
EndObjectMethod · 0.45
EndArrayMethod · 0.45

Tested by

no test coverage detected