Fix NanoUI runtimes when data is null; touch up code

This commit is contained in:
Bjorn Neergaard
2015-12-26 11:00:50 -06:00
parent 245b4a6ee9
commit 0cb8d73e93
7 changed files with 32 additions and 27 deletions
+5 -5
View File
@@ -22,23 +22,23 @@
/client/Topic(href, href_list, hsrc)
if(!usr || usr != mob) //stops us calling Topic for somebody else's client. Also helps prevent usr=null
return
// NanoUI
if(href_list["nano_error"])
src << href_list["nano_error"]
throw EXCEPTION("NanoUI: [href_list["nano_error"]]")
// asset_cache
if(href_list["asset_cache_confirm_arrival"])
//src << "ASSET JOB [href_list["asset_cache_confirm_arrival"]] ARRIVED."
var/job = text2num(href_list["asset_cache_confirm_arrival"])
completed_asset_jobs += job
return
//Admin PM
// Admin PM
if(href_list["priv_msg"])
if (href_list["ahelp_reply"])
cmd_ahelp_reply(href_list["priv_msg"])
return
cmd_admin_pm(href_list["priv_msg"],null)
return
// NanoUI
if(href_list["nano_error"])
src << href_list["nano_error"]
throw EXCEPTION("NanoUI: [href_list["nano_error"]]")
//Logs all hrefs
if(config && config.log_hrefs && href_logfile)
+6 -11
View File
@@ -226,12 +226,8 @@
"title" = title,
"status" = status,
"layout" = layout,
"window" = window_id,
"ref" = "\ref[src]",
"window" = list(
"width" = width,
"height" = height,
"ref" = window_id
),
"user" = list(
"name" = user.name,
"fancy" = user.client.prefs.nanoui_fancy,
@@ -269,8 +265,8 @@
* private
*
* Handle clicks from the NanoUI.
* Call the src_object's Topic() if status is NANO_INTERACTIVE.
* If the src_object's Topic() returns 1, update all UIs attacked to it.
* Call the src_object's ui_act() if status is NANO_INTERACTIVE.
* If the src_object's ui_act() returns 1, update all UIs attacked to it.
**/
/datum/nanoui/Topic(href, href_list)
update_status(push = 0) // Update the window state.
@@ -280,10 +276,9 @@
var/action = href_list["nano"] // Pull the action out.
href_list -= "nano"
var/update = src_object.ui_act(action, href_list, state) // Call Topic() on the src_object.
var/update = src_object.ui_act(action, href_list, state) // Call ui_act() on the src_object.
if(src_object && update)
SSnano.update_uis(src_object) // If we have a src_object and its Topic() told us to update.
SSnano.update_uis(src_object) // If we have a src_object and its ui_act() told us to update.
/**
* private
@@ -313,7 +308,7 @@
**/
/datum/nanoui/proc/push_data(data, force = 0)
update_status(push = 0) // Update the window state.
if(status == NANO_DISABLED && !force)
if(status <= NANO_DISABLED && !force)
return // Cannot update UI, we have no visibility.
var/list/send_data = get_send_data(data) // Get the data to send.