Hotfix for Cryo (JSON problems) and render issues (Internet Explorer)

Blame MSO
This commit is contained in:
Bjorn Neergaard
2015-12-02 19:48:16 -05:00
parent fd5423e0cc
commit 864caa9d62
6 changed files with 459 additions and 26 deletions
+17 -17
View File
@@ -1,17 +1,8 @@
#define LIST_FLAT 0
#define LIST_NESTED 1
#define LIST_OBJECT 2 //object in this case means json object, orther wise known as an associative list
#define LIST_OBJECT 2 // Object in this case means json object, ortherwise known as an associative list or array.
json_writer/var/use_cache = 0
json_writer/proc/WriteObject(list/L)
if(use_cache && L["__json_cache"])
return L["__json_cache"]
. = list()
for(var/k in L)
. += "\"[k]\":[write(L[k])]"
. = "{[list2text(., ",")]}"
json_writer/proc/write(val)
if(isnum(val))
@@ -25,10 +16,19 @@ json_writer/proc/write(val)
if (LIST_NESTED)
. = write_array(val)
if (LIST_OBJECT)
. = WriteObject(val)
. = write_object(val)
else
. = write_string("[val]")
json_writer/proc/write_object(list/L)
if(use_cache && L["__json_cache"])
return L["__json_cache"]
. = list()
for(var/k in L)
. += "\"[k]\":[write(L[k])]"
. = "{[list2text(., ",")]}"
json_writer/proc/write_flat_array(list/L)
. = "\[[list2text(L, ",")]]"
@@ -53,15 +53,15 @@ json_writer/proc/write_string(txt)
return {""[txt]""}
json_writer/proc/listtype(list/L)
. = LIST_FLAT
. = LIST_FLAT
for(var/key in L)
if (. == LIST_FLAT && istype(key, /list))
. = LIST_NESTED
if (!isnum(key) && !isnull(L[key]) && !istype(key, /list))
if (!isnum(key) && !istype(key, /list))
. = LIST_OBJECT
break // if it's an object, we can just stop now
break // If it's an object, we can just stop now.
#undef LIST_FLAT
#undef LIST_NESTED
#undef LIST_OBJECT
#undef LIST_OBJECT