Global variable wrappers (#25325)

* Add the system for managed global variables

* Travis ban old globals

* So you CAN inline proccall, that's neat

* Fix that

* master.dm

* Remove the hack procs

* Move InitGlobals to the proper spot

* configuration.dm

* Fix the missing pre-slash

* clockcult.dm

* This is probably for the best

* Doy

* Fix shit

* Rest of the DEFINES tree

* Fix

* Use global. for access

* Update find_references_in_globals

Always hated that proc

Whoever made it must've bee a r e a l idiot...

* __HELPERS tree

* Move global initialization to master.

Fix the declaration

* database.dm

* Dat newline

* I said DECLARATIVE order!

* Here's something you can chew on @Iamgoofball

* game_modes.dm

* Fix this

* genetics.dm

* flavor_misc.dm

* More stuff

* Do it mso's way. Keep the controllers as global

* Make master actually see it

* Fix

* Finish _globalvars/lists

* Finish the rest of the _globalvars tree

* This is weird

* Migrate the controllers

* SLOTH -> GLOB

* Lighting globals

* round_start_time -> ticker

* PAI card list -> pai SS

* record_id_num -> static

* Diseases list -> SSdisease

* More disease globals to the SS

* More disease stuff

* Emote list

* Better and better

* Bluh

* So much stuff

* Ahh

* Wires

* dview

* station_areas

* Teleportlocs

* blood_splatter_icons

* Stuff and such

* More stuff

* RAD IO

* More stuff and such

* Blob shit

* Changeling stuff

* Add "Balance" to changelogs

* Balance for changelog compiler + Auto Tagging

* Update the PR template

* hivemind_bank

* Bip

* sacrificed

* Good shit

* Better define

* More cult shit

* Devil shit

* Gang shit

* > borers

Fix shit

* Rename the define

* Nuke

* Objectives

* Sandbox

* Multiverse sword

* Announce systems

* Stuff and such

* TC con

* Airlock

* doppllllerrrrrr

* holopads

* Shut up byond you inconsistent fuck

* Sneaky fuck

* Burp

* Bip

* Fixnshit

* Port without regard

* askdlfjs;

* asdfjasoidojfi

* Protected globals and more

* SO MANY

* ajsimkvahsaoisd

* akfdsiaopwimfeoiwafaw

* gsdfigjosidjfgiosdg

* AHHHHHHHHHHHHHHHHHHHHHHH!!!!!

* facerolll

* ASDFASDFASDF

* Removes the unused parts of dmm_suite

* WIP

* Fix quote

* asdfjauwfnkjs

* afwlunhskjfda

* asfjlaiwuefhaf

* SO CLOSE

* wwwweeeeeewwwww

* agdgmoewranwg

* HOLY MOTHER OF FUCK AND THATS JUST HALF THE JOB?!?

* Fix syntax errors

* 100 errors

* Another 100

* So many...

* Ugh

* More shit

* kilme

* Stuuuuuufffff

* ajrgmrlshio;djfa;sdkl

* jkbhkhjbmjvjmh

* soi soi soi

* butt

* TODAY WE LEARNED THAT GLOBAL AND STATIC ARE THE EXACT SAME FUCKING THING

* lllllllllllllllllllllllllllllllllllllllllll

* afsdijfiawhnflnjhnwsdfs

* yugykihlugk,kj

* time to go

* STUFFF!!!

* AAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!

* ngoaijdjlfkamsdlkf

* Break time

* aufjsdklfalsjfi

* CONTROL KAY AND PRAY

* IT COMPILEELEELELAKLJFKLDAFJLKFDJLADKJHFLJKAJGAHIEJALDFJ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

* Goteem

* Fix testing mode

* This does not belong in this PR

* Convert it to a controller

* Eh, fuck this option

* Revert controllerization Ill do it some other time

* Fix

* Working controllerization

* FOR THE LOVE OF CHRIST PROTECT THE LOGS

* Protect admins and deadmins

* Use the inbuilt proc
This commit is contained in:
Cyberboss
2017-04-07 01:26:13 -04:00
committed by duncathan salt
parent e550f019b0
commit 9e1ef0ffe2
825 changed files with 5425 additions and 6057 deletions
+22 -22
View File
@@ -1,5 +1,5 @@
/proc/create_message(type, target_ckey, admin_ckey, text, timestamp, server, secret, logged = 1, browse)
if(!dbcon.Connect())
if(!GLOB.dbcon.Connect())
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
return
if(!type)
@@ -9,7 +9,7 @@
if(!new_ckey)
return
new_ckey = sanitizeSQL(new_ckey)
var/DBQuery/query_find_ckey = dbcon.NewQuery("SELECT ckey FROM [format_table_name("player")] WHERE ckey = '[new_ckey]'")
var/DBQuery/query_find_ckey = GLOB.dbcon.NewQuery("SELECT ckey FROM [format_table_name("player")] WHERE ckey = '[new_ckey]'")
if(!query_find_ckey.warn_execute())
return
if(!query_find_ckey.NextRow())
@@ -44,7 +44,7 @@
secret = 0
else
return
var/DBQuery/query_create_message = dbcon.NewQuery("INSERT INTO [format_table_name("messages")] (type, targetckey, adminckey, text, timestamp, server, secret) VALUES ('[type]', '[target_ckey]', '[admin_ckey]', '[text]', '[timestamp]', '[server]', '[secret]')")
var/DBQuery/query_create_message = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("messages")] (type, targetckey, adminckey, text, timestamp, server, secret) VALUES ('[type]', '[target_ckey]', '[admin_ckey]', '[text]', '[timestamp]', '[server]', '[secret]')")
if(!query_create_message.warn_execute())
return
if(logged)
@@ -56,7 +56,7 @@
browse_messages(target_ckey = target_ckey)
/proc/delete_message(message_id, logged = 1, browse)
if(!dbcon.Connect())
if(!GLOB.dbcon.Connect())
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
return
message_id = text2num(message_id)
@@ -65,14 +65,14 @@
var/type
var/target_ckey
var/text
var/DBQuery/query_find_del_message = dbcon.NewQuery("SELECT type, targetckey, adminckey, text FROM [format_table_name("messages")] WHERE id = [message_id]")
var/DBQuery/query_find_del_message = GLOB.dbcon.NewQuery("SELECT type, targetckey, adminckey, text FROM [format_table_name("messages")] WHERE id = [message_id]")
if(!query_find_del_message.warn_execute())
return
if(query_find_del_message.NextRow())
type = query_find_del_message.item[1]
target_ckey = query_find_del_message.item[2]
text = query_find_del_message.item[4]
var/DBQuery/query_del_message = dbcon.NewQuery("DELETE FROM [format_table_name("messages")] WHERE id = [message_id]")
var/DBQuery/query_del_message = GLOB.dbcon.NewQuery("DELETE FROM [format_table_name("messages")] WHERE id = [message_id]")
if(!query_del_message.warn_execute())
return
if(logged)
@@ -84,13 +84,13 @@
browse_messages(target_ckey = target_ckey)
/proc/edit_message(message_id, browse)
if(!dbcon.Connect())
if(!GLOB.dbcon.Connect())
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
return
message_id = text2num(message_id)
if(!message_id)
return
var/DBQuery/query_find_edit_message = dbcon.NewQuery("SELECT type, targetckey, adminckey, text FROM [format_table_name("messages")] WHERE id = [message_id]")
var/DBQuery/query_find_edit_message = GLOB.dbcon.NewQuery("SELECT type, targetckey, adminckey, text FROM [format_table_name("messages")] WHERE id = [message_id]")
if(!query_find_edit_message.warn_execute())
return
if(query_find_edit_message.NextRow())
@@ -104,7 +104,7 @@
return
new_text = sanitizeSQL(new_text)
var/edit_text = sanitizeSQL("Edited by [editor_ckey] on [SQLtime()] from<br>[old_text]<br>to<br>[new_text]<hr>")
var/DBQuery/query_edit_message = dbcon.NewQuery("UPDATE [format_table_name("messages")] SET text = '[new_text]', lasteditor = '[editor_ckey]', edits = CONCAT(IFNULL(edits,''),'[edit_text]') WHERE id = [message_id]")
var/DBQuery/query_edit_message = GLOB.dbcon.NewQuery("UPDATE [format_table_name("messages")] SET text = '[new_text]', lasteditor = '[editor_ckey]', edits = CONCAT(IFNULL(edits,''),'[edit_text]') WHERE id = [message_id]")
if(!query_edit_message.warn_execute())
return
log_admin_private("[key_name(usr)] has edited a [type] [(type == "note" || type == "message" || type == "watchlist entry") ? " for [target_ckey]" : ""] made by [admin_ckey] from [old_text] to [new_text]")
@@ -115,13 +115,13 @@
browse_messages(target_ckey = target_ckey)
/proc/toggle_message_secrecy(message_id)
if(!dbcon.Connect())
if(!GLOB.dbcon.Connect())
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
return
message_id = text2num(message_id)
if(!message_id)
return
var/DBQuery/query_find_message_secret = dbcon.NewQuery("SELECT type, targetckey, adminckey, secret FROM [format_table_name("messages")] WHERE id = [message_id]")
var/DBQuery/query_find_message_secret = GLOB.dbcon.NewQuery("SELECT type, targetckey, adminckey, secret FROM [format_table_name("messages")] WHERE id = [message_id]")
if(!query_find_message_secret.warn_execute())
return
if(query_find_message_secret.NextRow())
@@ -131,7 +131,7 @@
var/secret = text2num(query_find_message_secret.item[4])
var/editor_ckey = sanitizeSQL(usr.ckey)
var/edit_text = "Made [secret ? "not secret" : "secret"] by [editor_ckey] on [SQLtime()]<hr>"
var/DBQuery/query_message_secret = dbcon.NewQuery("UPDATE [format_table_name("messages")] SET secret = NOT secret, lasteditor = '[editor_ckey]', edits = CONCAT(IFNULL(edits,''),'[edit_text]') WHERE id = [message_id]")
var/DBQuery/query_message_secret = GLOB.dbcon.NewQuery("UPDATE [format_table_name("messages")] SET secret = NOT secret, lasteditor = '[editor_ckey]', edits = CONCAT(IFNULL(edits,''),'[edit_text]') WHERE id = [message_id]")
if(!query_message_secret.warn_execute())
return
log_admin_private("[key_name(usr)] has toggled [target_ckey]'s [type] made by [admin_ckey] to [secret ? "not secret" : "secret"]")
@@ -139,13 +139,13 @@
browse_messages(target_ckey = target_ckey)
/proc/browse_messages(type, target_ckey, index, linkless = 0, filter)
if(!dbcon.Connect())
if(!GLOB.dbcon.Connect())
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
return
var/output
var/ruler = "<hr style='background:#000000; border:0; height:3px'>"
var/navbar = "<a href='?_src_=holder;nonalpha=1'>\[All\]</a>|<a href='?_src_=holder;nonalpha=2'>\[#\]</a>"
for(var/letter in alphabet)
for(var/letter in GLOB.alphabet)
navbar += "|<a href='?_src_=holder;showmessages=[letter]'>\[[letter]\]</a>"
navbar += "|<a href='?_src_=holder;showmemo=1'>\[Memos\]</a>|<a href='?_src_=holder;showwatch=1'>\[Watchlist\]</a>"
navbar += "<br><form method='GET' name='search' action='?'>\
@@ -166,13 +166,13 @@
else
output += "|<a href='?_src_=holder;showwatchfilter=1'>\[Filter offline clients\]</a></center>"
output += ruler
var/DBQuery/query_get_type_messages = dbcon.NewQuery("SELECT id, targetckey, adminckey, text, timestamp, server, lasteditor FROM [format_table_name("messages")] WHERE type = '[type]'")
var/DBQuery/query_get_type_messages = GLOB.dbcon.NewQuery("SELECT id, targetckey, adminckey, text, timestamp, server, lasteditor FROM [format_table_name("messages")] WHERE type = '[type]'")
if(!query_get_type_messages.warn_execute())
return
while(query_get_type_messages.NextRow())
var/id = query_get_type_messages.item[1]
var/t_ckey = query_get_type_messages.item[2]
if(type == "watchlist entry" && filter && !(t_ckey in directory))
if(type == "watchlist entry" && filter && !(t_ckey in GLOB.directory))
continue
var/admin_ckey = query_get_type_messages.item[3]
var/text = query_get_type_messages.item[4]
@@ -190,7 +190,7 @@
output += "<br>[text]<hr style='background:#000000; border:0; height:1px'>"
if(target_ckey)
target_ckey = sanitizeSQL(target_ckey)
var/DBQuery/query_get_messages = dbcon.NewQuery("SELECT type, secret, id, adminckey, text, timestamp, server, lasteditor FROM [format_table_name("messages")] WHERE type <> 'memo' AND targetckey = '[target_ckey]' ORDER BY timestamp DESC")
var/DBQuery/query_get_messages = GLOB.dbcon.NewQuery("SELECT type, secret, id, adminckey, text, timestamp, server, lasteditor FROM [format_table_name("messages")] WHERE type <> 'memo' AND targetckey = '[target_ckey]' ORDER BY timestamp DESC")
if(!query_get_messages.warn_execute())
return
var/messagedata
@@ -265,7 +265,7 @@
search = "^\[^\[:alpha:\]\]"
else
search = "^[index]"
var/DBQuery/query_list_messages = dbcon.NewQuery("SELECT DISTINCT targetckey FROM [format_table_name("messages")] WHERE type <> 'memo' AND targetckey REGEXP '[search]' ORDER BY targetckey")
var/DBQuery/query_list_messages = GLOB.dbcon.NewQuery("SELECT DISTINCT targetckey FROM [format_table_name("messages")] WHERE type <> 'memo' AND targetckey REGEXP '[search]' ORDER BY targetckey")
if(!query_list_messages.warn_execute())
return
while(query_list_messages.NextRow())
@@ -277,7 +277,7 @@
usr << browse(output, "window=browse_messages;size=900x500")
proc/get_message_output(type, target_ckey)
if(!dbcon.Connect())
if(!GLOB.dbcon.Connect())
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
return
if(!type)
@@ -288,7 +288,7 @@ proc/get_message_output(type, target_ckey)
var/query = "SELECT id, adminckey, text, timestamp, lasteditor FROM [format_table_name("messages")] WHERE type = '[type]'"
if(type == "message" || type == "watchlist entry")
query += " AND targetckey = '[target_ckey]'"
var/DBQuery/query_get_message_output = dbcon.NewQuery(query)
var/DBQuery/query_get_message_output = GLOB.dbcon.NewQuery(query)
if(!query_get_message_output.warn_execute())
return
while(query_get_message_output.NextRow())
@@ -301,7 +301,7 @@ proc/get_message_output(type, target_ckey)
if("message")
output += "<font color='red' size='3'><b>Admin message left by <span class='prefix'>[admin_ckey]</span> on [timestamp]</b></font>"
output += "<br><font color='red'>[text]</font><br>"
var/DBQuery/query_message_read = dbcon.NewQuery("UPDATE [format_table_name("messages")] SET type = 'message sent' WHERE id = [message_id]")
var/DBQuery/query_message_read = GLOB.dbcon.NewQuery("UPDATE [format_table_name("messages")] SET type = 'message sent' WHERE id = [message_id]")
if(!query_message_read.warn_execute())
return
if("watchlist entry")
@@ -333,7 +333,7 @@ proc/get_message_output(type, target_ckey)
var/timestamp = note.group[1]
notetext = note.group[2]
var/admin_ckey = note.group[3]
var/DBQuery/query_convert_time = dbcon.NewQuery("SELECT ADDTIME(STR_TO_DATE('[timestamp]','%d-%b-%Y'), '0')")
var/DBQuery/query_convert_time = GLOB.dbcon.NewQuery("SELECT ADDTIME(STR_TO_DATE('[timestamp]','%d-%b-%Y'), '0')")
if(!query_convert_time.Execute())
return
if(query_convert_time.NextRow())