From eca63077b8e0d02b28d548bc3a1b653f562545b7 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Fri, 30 Aug 2024 17:56:28 +0100 Subject: [PATCH] Cleaner model return --- project/code/TMV/ModelLoader.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project/code/TMV/ModelLoader.cs b/project/code/TMV/ModelLoader.cs index 8d986a1..c59a440 100644 --- a/project/code/TMV/ModelLoader.cs +++ b/project/code/TMV/ModelLoader.cs @@ -23,18 +23,18 @@ public class ModelLoader { if (_cache.TryGetValue((campaignName, modelName), out var fmModel)) { - return fmModel == null ? fmModel : fmModel.Duplicate() as MeshInstance3D; + return fmModel?.Duplicate() as MeshInstance3D; } else if (_cache.TryGetValue(("", modelName), out var omModel)) { - return omModel == null ? omModel : omModel.Duplicate() as MeshInstance3D; + return omModel?.Duplicate() as MeshInstance3D; } } // We don't care if this is null actually, we'll still cache that it's null lol var model = Timing.TimeStage("Load Models", () => { return LoadModel(_pathManager, ref campaignName, modelName); }); _cache[(campaignName, modelName)] = model; - return model == null ? model : model.Duplicate() as MeshInstance3D; + return model; } public static MeshInstance3D LoadModel(ResourcePathManager pathManager, ref string campaignName, string modelName)