Added RNG snapshotting for predicting

Allows RNG seeds to be played back in a predictive way paving the road for predictive behaviors that rely on RNG.
This commit is contained in:
Boondorl 2024-11-04 13:15:47 -05:00 committed by Ricardo Luís Vaz Silva
commit a1a4a97dcd
4 changed files with 26 additions and 4 deletions

View file

@ -388,6 +388,21 @@ FRandom *FRandom::StaticFindRNG (const char *name, bool client)
return probe;
}
void FRandom::SaveRNGState(TArray<FRandom>& backups)
{
for (auto cur = RNGList; cur != nullptr; cur = cur->Next)
backups.Push(*cur);
}
void FRandom::RestoreRNGState(TArray<FRandom>& backups)
{
unsigned int i = 0u;
for (auto cur = RNGList; cur != nullptr; cur = cur->Next)
*cur = backups[i++];
backups.Clear();
}
//==========================================================================
//
// FRandom :: StaticPrintSeeds