Continual updates until merged
This commit is contained in:
@@ -531,10 +531,11 @@
|
||||
return
|
||||
sync_ranks_with_db()
|
||||
var/list/sql_admins = list()
|
||||
for(var/datum/admins/A in GLOB.protected_admins)
|
||||
var/sql_ckey = sanitizeSQL(A.owner.ckey)
|
||||
for(var/i in GLOB.protected_admins)
|
||||
var/datum/admins/A = GLOB.protected_admins[i]
|
||||
var/sql_ckey = sanitizeSQL(A.target)
|
||||
var/sql_rank = sanitizeSQL(A.rank.name)
|
||||
sql_admins = list(list("ckey" = "'[sql_ckey]'", "rank" = "'[sql_rank]'"))
|
||||
sql_admins += list(list("ckey" = "'[sql_ckey]'", "rank" = "'[sql_rank]'"))
|
||||
SSdbcore.MassInsert(format_table_name("admin"), sql_admins, duplicate_key = TRUE)
|
||||
var/datum/DBQuery/query_admin_rank_update = SSdbcore.NewQuery("UPDATE [format_table_name("player")] p INNER JOIN [format_table_name("admin")] a ON p.ckey = a.ckey SET p.lastadminrank = a.rank")
|
||||
query_admin_rank_update.Execute()
|
||||
@@ -582,4 +583,4 @@
|
||||
qdel(query_update_everything_ranks)
|
||||
return
|
||||
qdel(query_update_everything_ranks)
|
||||
qdel(query_check_everything_ranks)
|
||||
qdel(query_check_everything_ranks)
|
||||
@@ -0,0 +1,43 @@
|
||||
GLOBAL_LIST_EMPTY(typelists)
|
||||
|
||||
#ifndef TESTING
|
||||
|
||||
/datum/proc/typelist(key, list/values = list())
|
||||
var/list/mytypelist = GLOB.typelists[type] || (GLOB.typelists[type] = list())
|
||||
return mytypelist[key] || (mytypelist[key] = values.Copy())
|
||||
|
||||
#else
|
||||
// mostly the same code as above, just more verbose, slower and has tallying for saved lists
|
||||
/datum/proc/typelist(key, list/values)
|
||||
if (!values)
|
||||
values = list()
|
||||
GLOB.typelistkeys |= key
|
||||
if (GLOB.typelists[type])
|
||||
if (GLOB.typelists[type][key])
|
||||
GLOB.typelists[type]["[key]-saved"]++
|
||||
return GLOB.typelists[type][key]
|
||||
else
|
||||
GLOB.typelists[type][key] = values.Copy()
|
||||
else
|
||||
GLOB.typelists[type] = list()
|
||||
GLOB.typelists[type][key] = values.Copy()
|
||||
return GLOB.typelists[type][key]
|
||||
|
||||
GLOBAL_LIST_EMPTY(typelistkeys)
|
||||
|
||||
/proc/tallytypelistsavings()
|
||||
var/savings = list()
|
||||
var/saveditems = list()
|
||||
for (var/key in GLOB.typelistkeys)
|
||||
savings[key] = 0
|
||||
saveditems[key] = 0
|
||||
|
||||
for (var/type in GLOB.typelists)
|
||||
for (var/saving in savings)
|
||||
if (GLOB.typelists[type]["[saving]-saved"])
|
||||
savings[saving] += GLOB.typelists[type]["[saving]-saved"]
|
||||
saveditems[saving] += (GLOB.typelists[type]["[saving]-saved"] * length(GLOB.typelists[type][saving]))
|
||||
|
||||
for (var/saving in savings)
|
||||
to_chat(world, "Savings for [saving]: [savings[saving]] lists, [saveditems[saving]] items")
|
||||
#endif
|
||||
Reference in New Issue
Block a user