Fixed server failing to assign jobs to all clients on some modded servers: if the max amount of players per job had been reached on all the jobs the client has in their preferences, the client would not get a job at all (causing crashes later on when trying to access the client's job). Now the server assigns a random job if none of the preferred jobs are available.
+ Fix for exceptions in Client constructor if there are less than 3 job prefabs.
This commit is contained in:
@@ -111,7 +111,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
votes = new object[Enum.GetNames(typeof(VoteType)).Length];
|
||||
|
||||
jobPreferences = new List<JobPrefab>(JobPrefab.List.GetRange(0, 3));
|
||||
jobPreferences = new List<JobPrefab>(JobPrefab.List.GetRange(0, Math.Min(JobPrefab.List.Count, 3)));
|
||||
|
||||
entityEventLastSent = new Dictionary<UInt16, float>();
|
||||
}
|
||||
@@ -135,7 +135,7 @@ namespace Barotrauma.Networking
|
||||
name = name.Substring(0, 20);
|
||||
}
|
||||
string rName = "";
|
||||
for (int i=0;i<name.Length;i++)
|
||||
for (int i = 0; i < name.Length; i++)
|
||||
{
|
||||
if (name[i] < 32)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user