From 758d746e96def1d4903149218cabfc906ae4393a Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Thu, 23 Jul 2020 12:25:02 -0700 Subject: [PATCH] compile --- code/__HELPERS/sanitize_values.dm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/__HELPERS/sanitize_values.dm b/code/__HELPERS/sanitize_values.dm index 4d726c926a..e53bf275d6 100644 --- a/code/__HELPERS/sanitize_values.dm +++ b/code/__HELPERS/sanitize_values.dm @@ -56,7 +56,7 @@ #define RGB_FORMAT_LONG 2 /** - * Sanitizes a hexadecimal color. + * Sanitizes a hexadecimal color. Always outputs lowercase. * * @params * * color - input color, 3 or 6 characters without the #. @@ -70,6 +70,7 @@ CRASH("Default should be a text string of RGB format, with or without the crunch, 3 or 6 characters. Default was instead [default]") if(!istext(default_replacement) || (length(default_replacement) != 1)) CRASH("Invalid default_replacement: [default_replacement]") + default_replacement = lowertext(default_replacement) switch(text2ascii(default_replacement)) if(48 to 57) if(97 to 102) @@ -116,6 +117,7 @@ CRASH("Default was not 3 or 6 RGB hexadecimal characters: [default]") var/sanitized = "" + var/char = "" // first, sanitize hex for(var/i in 1 to len) char = color[i] @@ -127,7 +129,7 @@ if(65 to 70) // A to F (capitalized!) sanitized += lowertext(char) else - sanitized += lowertext(default_replacement) + sanitized += default_replacement // do we need to convert? if(desired_format == current_format) return crunch + sanitized // no @@ -145,7 +147,7 @@ temp += sanitized[i] sanitized = temp else - CRAHS("Invalid desired_format and current_format pair: [desired_format], [current_format]. Could not determine which way to convert.") + CRASH("Invalid desired_format and current_format pair: [desired_format], [current_format]. Could not determine which way to convert.") return crunch + sanitized #undef RGB_FORMAT_INVALID