Re-organize in-memory character profile storage.

Now uses a dictionary of int -> profile instead of an array filled with nulls.
This commit is contained in:
Pieter-Jan Briers
2020-10-06 15:13:16 +02:00
parent 0b1fd94dc9
commit 390d064304
12 changed files with 228 additions and 204 deletions

View File

@@ -193,7 +193,7 @@ namespace Content.Shared.Preferences
_ => PreferenceUnavailableMode.StayInLobby // Invalid enum values.
};
var priorities = profile.JobPriorities
var priorities = new Dictionary<string, JobPriority>(profile.JobPriorities
.Where(p => prototypeManager.HasIndex<JobPrototype>(p.Key) && p.Value switch
{
JobPriority.Never => false, // Drop never since that's assumed default.
@@ -201,9 +201,7 @@ namespace Content.Shared.Preferences
JobPriority.Medium => true,
JobPriority.High => true,
_ => false
})
.ToDictionary(p => p.Key, p => p.Value);
}));
var antags = profile.AntagPreferences
.Where(prototypeManager.HasIndex<AntagPrototype>)