More reworking of DB handling

sqllogging depracted in favour of config.sql_enabled. Database loading is done through /hook/startup/proc/load_databases, with initialize_database_object() being a generalized proc to read any generic database config file. (TODO: config examples in relaiton to last remark.)
This commit is contained in:
skull132
2016-03-04 01:41:44 +02:00
parent 8383f1c03b
commit 202b216092
5 changed files with 54 additions and 65 deletions
+1 -41
View File
@@ -277,7 +277,7 @@ var/list/gamemode_cache = list()
config.log_access = 1
if ("sql_enabled")
config.sql_enabled = text2num(value)
config.sql_enabled = 1
if ("log_say")
config.log_say = 1
@@ -737,46 +737,6 @@ var/list/gamemode_cache = list()
else
log_misc("Unknown setting in configuration: '[name]'")
/datum/configuration/proc/loadsql(filename) // -- TLE
var/list/Lines = file2list(filename)
for(var/t in Lines)
if(!t) continue
t = trim(t)
if (length(t) == 0)
continue
else if (copytext(t, 1, 2) == "#")
continue
var/pos = findtext(t, " ")
var/name = null
var/value = null
if (pos)
name = lowertext(copytext(t, 1, pos))
value = copytext(t, pos + 1)
else
name = lowertext(t)
if (!name)
continue
switch (name)
if ("address")
sqladdress = value
if ("port")
sqlport = value
if ("database")
sqldb = value
if ("login")
sqllogin = value
if ("password")
sqlpass = value
if ("enable_stat_tracking")
sqllogging = 1
else
log_misc("Unknown setting in configuration: '[name]'")
/datum/configuration/proc/pick_mode(mode_name)
// I wish I didn't have to instance the game modes in order to look up
// their information, but it is the only way (at least that I know of).