(618410bf9) Fixed clients crashing when opening the server settings menu

This commit is contained in:
Joonas Rikkonen
2019-06-04 15:36:58 +03:00
parent 82dee0ffd7
commit b31fbe23da
2 changed files with 8 additions and 3 deletions
@@ -464,7 +464,8 @@ namespace Barotrauma.Networking
((GUIComponent)obj).Visible = !((GUIComponent)obj).Visible; ((GUIComponent)obj).Visible = !((GUIComponent)obj).Visible;
return true; return true;
}; };
InitMonstersEnabled();
List<string> monsterNames = MonsterEnabled.Keys.ToList(); List<string> monsterNames = MonsterEnabled.Keys.ToList();
tempMonsterEnabled = new Dictionary<string, bool>(MonsterEnabled); tempMonsterEnabled = new Dictionary<string, bool>(MonsterEnabled);
foreach (string s in monsterNames) foreach (string s in monsterNames)
@@ -656,7 +656,7 @@ namespace Barotrauma.Networking
private set; private set;
} = new List<Pair<int, int>>(); } = new List<Pair<int, int>>();
public void ReadMonsterEnabled(NetBuffer inc) private void InitMonstersEnabled()
{ {
//monster spawn settings //monster spawn settings
if (MonsterEnabled == null) if (MonsterEnabled == null)
@@ -673,7 +673,11 @@ namespace Barotrauma.Networking
if (!MonsterEnabled.ContainsKey(s)) MonsterEnabled.Add(s, true); if (!MonsterEnabled.ContainsKey(s)) MonsterEnabled.Add(s, true);
} }
} }
}
public void ReadMonsterEnabled(NetBuffer inc)
{
InitMonstersEnabled();
List<string> monsterNames = MonsterEnabled.Keys.ToList(); List<string> monsterNames = MonsterEnabled.Keys.ToList();
foreach (string s in monsterNames) foreach (string s in monsterNames)
{ {
@@ -681,7 +685,7 @@ namespace Barotrauma.Networking
} }
inc.ReadPadBits(); inc.ReadPadBits();
} }
public void WriteMonsterEnabled(NetBuffer msg, Dictionary<string, bool> monsterEnabled = null) public void WriteMonsterEnabled(NetBuffer msg, Dictionary<string, bool> monsterEnabled = null)
{ {
//monster spawn settings //monster spawn settings