"Shifting" entity IDs to prevent them from overlapping between different subs, loading another submarine now works without crashing

This commit is contained in:
Regalis
2016-06-10 20:53:35 +03:00
parent 7349cdd310
commit ee2d817e6b
14 changed files with 83 additions and 44 deletions

View File

@@ -9,7 +9,7 @@ namespace Barotrauma
public static void StartTutorial(TutorialType tutorialType)
{
Submarine.Load("Content/Map/TutorialSub.sub", "");
Submarine.Load("Content/Map/TutorialSub.sub", "", true);
tutorialType.Initialize();

View File

@@ -125,7 +125,10 @@ namespace Barotrauma
return;
}
if (reloadSub || Submarine.MainSub != submarine) submarine.Load();
if (reloadSub || Submarine.MainSub != submarine) submarine.Load(true);
//var secondSub = new Submarine(submarine.FilePath, submarine.MD5Hash.Hash);
//secondSub.Load(false);
if (level != null)
{
@@ -133,6 +136,8 @@ namespace Barotrauma
submarine.SetPosition(level.StartPosition - new Vector2(0.0f, 2000.0f));
//secondSub.SetPosition(level.EndPosition - new Vector2(0.0f, 2000.0f));
GameMain.GameScreen.BackgroundCreatureManager.SpawnSprites(80);
}