From 3aa6fd3dc445bb14a63a1a8cfee8da585301bb1e Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 2 Jan 2021 01:32:10 +0000 Subject: [PATCH] Add a friendly type name for Nullable. --- OpenRA.Mods.Common/Util.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenRA.Mods.Common/Util.cs b/OpenRA.Mods.Common/Util.cs index 7ca5426619..327fd4aabe 100644 --- a/OpenRA.Mods.Common/Util.cs +++ b/OpenRA.Mods.Common/Util.cs @@ -218,6 +218,9 @@ namespace OpenRA.Mods.Common if (t.IsGenericType && t.GetGenericTypeDefinition().GetInterfaces().Any(e => e.IsGenericType && e.GetGenericTypeDefinition() == typeof(IEnumerable<>))) return "Collection of {0}".F(FriendlyTypeName(t.GetGenericArguments().First())); + if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>)) + return "{0} (optional)".F(t.GetGenericArguments().Select(FriendlyTypeName).First()); + if (t == typeof(int) || t == typeof(uint)) return "Integer";