(b8f75ee96) Fixed level inequality errors caused by 866621c. Accessing the level start/end location properties during level generation caused the seed of RandSync.Server to be changed. Now generating a new random location uses a new MTRandom instance and doesn't touch RandSync.Server.

This commit is contained in:
Joonas Rikkonen
2019-03-31 19:12:27 +03:00
parent 8668647049
commit fa2a338d73
7 changed files with 22 additions and 31 deletions
@@ -1519,14 +1519,6 @@ namespace Barotrauma
string outpostFile = outpostFiles.GetRandom(Rand.RandSync.Server);
var outpost = new Submarine(outpostFile, tryLoad: false);
outpost.Load(unloadPrevious: false);
if (i == 0)
{
if (GameMain.GameSession?.StartLocation != null) { outpost.Name = GameMain.GameSession.StartLocation.Name; }
}
else
{
if (GameMain.GameSession?.EndLocation != null) { outpost.Name = GameMain.GameSession.EndLocation.Name; }
}
outpost.MakeOutpost();
Point? minSize = null;
@@ -1567,10 +1559,12 @@ namespace Barotrauma
if ((i == 0) == !Mirrored)
{
StartOutpost = outpost;
if (GameMain.GameSession?.StartLocation != null) { outpost.Name = GameMain.GameSession.StartLocation.Name; }
}
else
{
EndOutpost = outpost;
if (GameMain.GameSession?.EndLocation != null) { outpost.Name = GameMain.GameSession.EndLocation.Name; }
}
}
}