From b07bca861f61892a7bb901ac6edb1ff632265d5a Mon Sep 17 00:00:00 2001 From: fleure Date: Sat, 28 Dec 2013 16:30:50 +0000 Subject: [PATCH] Fixes paper with no input looking populated --- code/modules/paperwork/paper.dm | 20 ++++++++++++-------- code/modules/paperwork/photocopier.dm | 27 ++++++++++++++------------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index ca2921c503d..b2663a00cdc 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -159,6 +159,9 @@ /obj/item/weapon/paper/proc/parsepencode(t, obj/item/weapon/pen/P, mob/user, iscrayon = 0) + if(length(t) < 1) //No input means nothing needs to be parsed + return + // t = copytext(sanitize(t),1,MAX_MESSAGE_LEN) t = replacetext(t, "\[center\]", "
") @@ -249,15 +252,16 @@ return t = parsepencode(t, i, usr, iscrayon) // Encode everything from pencode to html + + if(t != null) //No input from the user means nothing needs to be added + if(id!="end") + addtofield(text2num(id), t) // He wants to edit a field, let him. + else + info += t // Oh, he wants to edit to the end of the file, let him. + updateinfolinks() - if(id!="end") - addtofield(text2num(id), t) // He wants to edit a field, let him. - else - info += t // Oh, he wants to edit to the end of the file, let him. - updateinfolinks() - - usr << browse("[name][info_links]
[stamps]", "window=[name]") // Update the window - update_icon() + usr << browse("[name][info_links]
[stamps]", "window=[name]") // Update the window + update_icon() /obj/item/weapon/paper/attackby(obj/item/weapon/P, mob/user) diff --git a/code/modules/paperwork/photocopier.dm b/code/modules/paperwork/photocopier.dm index ef929633873..9633c118ee2 100644 --- a/code/modules/paperwork/photocopier.dm +++ b/code/modules/paperwork/photocopier.dm @@ -65,19 +65,20 @@ for(var/i = 0, i < copies, i++) if(toner > 0 && !busy && copy) var/obj/item/weapon/paper/c = new /obj/item/weapon/paper (loc) - if(toner > 10) //lots of toner, make it dark - c.info = "" - else //no toner? shitty copies for you! - c.info = "" - var/copied = html_decode(copy.info) - copied = replacetext(copied, "" - c.name = copy.name - c.fields = copy.fields - c.updateinfolinks() - toner-- + if(length(copy.info) > 0) //Only print and add content if the copied doc has words on it + if(toner > 10) //lots of toner, make it dark + c.info = "" + else //no toner? shitty copies for you! + c.info = "" + var/copied = html_decode(copy.info) + copied = replacetext(copied, "" + c.name = copy.name + c.fields = copy.fields + c.updateinfolinks() + toner-- busy = 1 sleep(15) busy = 0