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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user