Merge pull request #8984 from volas/master

Fixes #8913
This commit is contained in:
PsiOmegaDelta
2015-04-28 07:53:45 +02:00

View File

@@ -22,6 +22,7 @@
var/info_links //A different version of the paper which includes html links at fields and EOF var/info_links //A different version of the paper which includes html links at fields and EOF
var/stamps //The (text for the) stamps on the paper. var/stamps //The (text for the) stamps on the paper.
var/fields //Amount of user created fields var/fields //Amount of user created fields
var/free_space = MAX_PAPER_MESSAGE_LEN
var/list/stamped var/list/stamped
var/list/ico[0] //Icons and var/list/ico[0] //Icons and
var/list/offset_x[0] //offsets stored for later var/list/offset_x[0] //offsets stored for later
@@ -51,6 +52,7 @@
spawn(2) spawn(2)
update_icon() update_icon()
update_space(info)
updateinfolinks() updateinfolinks()
return return
@@ -62,6 +64,12 @@
return return
icon_state = "paper" icon_state = "paper"
/obj/item/weapon/paper/proc/update_space(var/new_text)
if(!new_text)
return
free_space -= length(strip_html_properly(new_text, 0))
/obj/item/weapon/paper/examine(mob/user) /obj/item/weapon/paper/examine(mob/user)
..() ..()
if(in_range(user, src) || istype(user, /mob/dead/observer)) if(in_range(user, src) || istype(user, /mob/dead/observer))
@@ -188,6 +196,7 @@
/obj/item/weapon/paper/proc/clearpaper() /obj/item/weapon/paper/proc/clearpaper()
info = null info = null
stamps = null stamps = null
free_space = MAX_PAPER_MESSAGE_LEN
stamped = list() stamped = list()
overlays.Cut() overlays.Cut()
updateinfolinks() updateinfolinks()
@@ -325,12 +334,11 @@
var/id = href_list["write"] var/id = href_list["write"]
//var/t = strip_html_simple(input(usr, "What text do you wish to add to " + (id=="end" ? "the end of the paper" : "field "+id) + "?", "[name]", null),8192) as message //var/t = strip_html_simple(input(usr, "What text do you wish to add to " + (id=="end" ? "the end of the paper" : "field "+id) + "?", "[name]", null),8192) as message
var/textlimit = MAX_PAPER_MESSAGE_LEN - length(info) if(free_space <= 0)
if(textlimit <= 0)
usr << "<span class='info'>You're trying to find a free place on paper, but can't!</span>" usr << "<span class='info'>You're trying to find a free place on paper, but can't!</span>"
return return
var/t = strip_html_simple(input("Enter what you want to write:", "Write", null, null) as message, textlimit) var/t = strip_html_simple(input("Enter what you want to write:", "Write", null, null) as message, free_space)
if(!t) if(!t)
return return
@@ -375,6 +383,8 @@
info += t // Oh, he wants to edit to the end of the file, let him. info += t // Oh, he wants to edit to the end of the file, let him.
updateinfolinks() updateinfolinks()
update_space(t)
usr << browse("<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[info_links][stamps]</BODY></HTML>", "window=[name]") // Update the window usr << browse("<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[info_links][stamps]</BODY></HTML>", "window=[name]") // Update the window
update_icon() update_icon()