mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
- Fixed: Reading the RNG states from a savegame calculated the amounts of
RNGs in the savegame wrong. SVN r1508 (trunk)
This commit is contained in:
parent
7371c4a516
commit
26420a9c60
2 changed files with 9 additions and 2 deletions
|
@ -1,4 +1,8 @@
|
|||
March 26, 2009
|
||||
March 27, 2009 (Changes by Graf Zahl)
|
||||
- Fixed: Reading the RNG states from a savegame calculated the amounts of
|
||||
RNGs in the savegame wrong.
|
||||
|
||||
March 26, 2009
|
||||
- Changed random seed initialization so that it uses the system's
|
||||
cryptographically secure random number generator, if available, instead
|
||||
of the current time.
|
||||
|
|
|
@ -269,6 +269,7 @@ void FRandom::StaticWriteRNGState (FILE *file)
|
|||
// Only write those RNGs that have names
|
||||
if (rng->NameCRC != 0)
|
||||
{
|
||||
Printf("Writing RNG %s\n", rng->Name);
|
||||
arc << rng->NameCRC << rng->idx;
|
||||
for (int i = 0; i < SFMT::N32; ++i)
|
||||
{
|
||||
|
@ -295,7 +296,8 @@ void FRandom::StaticReadRNGState (PNGHandle *png)
|
|||
|
||||
if (len != 0)
|
||||
{
|
||||
const int rngcount = (int)((len-4) / 8);
|
||||
const size_t sizeof_rng = sizeof(rng->NameCRC) + sizeof(rng->idx) + sizeof(rng->sfmt.u);
|
||||
const int rngcount = (int)((len-4) / sizeof_rng);
|
||||
int i;
|
||||
DWORD crc;
|
||||
|
||||
|
@ -311,6 +313,7 @@ void FRandom::StaticReadRNGState (PNGHandle *png)
|
|||
{
|
||||
if (rng->NameCRC == crc)
|
||||
{
|
||||
Printf("Reading RNG %s\n", rng->Name);
|
||||
arc << rng->idx;
|
||||
for (int i = 0; i < SFMT::N32; ++i)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue