Fix list_values to support lists of lists. Fix missing variable init.

This commit is contained in:
Leshana
2020-03-19 17:49:21 -04:00
parent 2b811c91b2
commit cf7d50978e
2 changed files with 6 additions and 4 deletions

View File

@@ -324,9 +324,11 @@ This actually tests if they have the same entries and values.
// Return a list of the values in an assoc list (including null)
/proc/list_values(var/list/L)
. = list()
for(var/e in L)
. += L[e]
var/list/V = list()
V.len = L.len // Preallocate!
for(var/i in 1 to L.len)
V[i] = L[L[i]] // We avoid += in case the value is itself a list
return V
//Mergesort: divides up the list into halves to begin the sort
/proc/sortKey(var/list/client/L, var/order = 1)

View File

@@ -53,7 +53,7 @@
/obj/machinery/embedded_controller/radio/airlock/docking_port_multi/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/data[0]
var/datum/computer/file/embedded_program/airlock/multi_docking/airlock_program // Cast to proper type
var/datum/computer/file/embedded_program/airlock/multi_docking/airlock_program = program // Cast to proper type
data = list(
"chamber_pressure" = round(airlock_program.memory["chamber_sensor_pressure"]),