Fixes RCD crash and character weirdness (#26986)

This commit is contained in:
Exxion
2020-06-30 09:57:39 -04:00
committed by GitHub
parent cbfe7e4e47
commit 6c2410e4db
2 changed files with 5 additions and 8 deletions

View File

@@ -80,12 +80,9 @@ forLineInText(text)
i = findtext(Haystack, Needle, i + 1, End)
//Removes a few problematic characters
/proc/sanitize_simple(var/t,var/list/repl_chars = list("\n"="#","\t"="#","<22>"="<22>"))
/proc/sanitize_simple(var/t,var/list/repl_chars = list("\n"="#","\t"="#"))
for(var/char in repl_chars)
var/index = findtext(t, char)
while(index)
t = copytext(t, 1, index) + repl_chars[char] + copytext(t, index+1)
index = findtext(t, char)
t = replacetext(t, char, repl_chars[char])
return t
//Runs byond's sanitization proc along-side sanitize_simple

View File

@@ -353,7 +353,7 @@
playsound(master, 'sound/items/Deconstruct.ogg', 50, 1)
var/obj/machinery/door/airlock/D = new selected.build_type(A)
if(capitalize(selected_name) == selected_name) //The name inputted is capitalized, so we add \improper.
if(selected_name && (capitalize(selected_name) == selected_name)) //The name inputted is capitalized, so we add \improper.
D.name = "\improper [selected_name]"
else
D.name = selected_name
@@ -404,8 +404,8 @@
/datum/selection_schematic/airlock_schematic/clicked(var/mob/user)
if(master:selected == src)
master:selected_name = copytext(sanitize(input(usr,"What would you like to name this airlock?","Input a name",name) as text|null),1,MAX_NAME_LEN)
if(capitalize(master:selected_name) == master:selected_name)
master:selected_name = "\improper[master:selected_name]"
if(master:selected_name && (capitalize(master:selected_name) == master:selected_name))
master:selected_name = "\improper [master:selected_name]"
else
master.selected = src
// Schematics for schematics, I know, but it's OOP!