store old state of random generator to restore after a seed()

The light calculation requires the random generator to be seeded with a
constant - otherwise repeated light recalculations would make the lights
change.

This patch allows the random generator to go back to the state before the
static seed().
This commit is contained in:
ac-stef
2015-02-08 17:39:14 +01:00
parent 05a41b1c0a
commit 685dbb8326
3 changed files with 13 additions and 4 deletions
+2 -3
View File
@@ -195,8 +195,7 @@ void calclight()
s++;
}
uint keep = randomMT();
seedMT(ents.length() + hdr.maprevision);
seedMT(ents.length() + hdr.maprevision); // static seed -> nothing random here
loopv(ents)
{
@@ -204,7 +203,7 @@ void calclight()
if(e.type==LIGHT) calclightsource(e);
}
seedMT(keep);
popMT(); // undo the static seedMT() from above
block bb = { mapdims.x1 - 1, mapdims.y1 - 1, mapdims.xspan + 2, mapdims.yspan + 2 };
postlightarea(bb);