mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 04:51:32 +01:00
This is get over the shortcomings and failures of the old config system. Currently only applied to the DB configs because they're the ones fucking up. (reverted from commit 7e1f0d2285)
Reverted because further testing showcased the issue to be inside the mysql.dll instead of the game code. Weee I feel dumb.
This commit is contained in:
+22
-11
@@ -390,7 +390,7 @@ var/inerror = 0
|
||||
|
||||
/hook/startup/proc/load_databases()
|
||||
//Construct the database object from an init file.
|
||||
dbcon = initialize_database_object("config/dbconfig.json")
|
||||
dbcon = initialize_database_object("config/dbconfig.txt")
|
||||
|
||||
if (!setup_database_connection(dbcon))
|
||||
world.log << "Your server failed to establish a connection with the feedback database."
|
||||
@@ -405,20 +405,31 @@ var/inerror = 0
|
||||
|
||||
var/list/data = list("address", "port", "database", "login", "password")
|
||||
|
||||
var/list/Lines
|
||||
var/list/Lines = file2list(filename)
|
||||
|
||||
try
|
||||
Lines = json_decode(file2text(filename))
|
||||
catch(var/exception/e)
|
||||
error("Error reading database config file '[filename]': [e]")
|
||||
return new/DBConnection()
|
||||
|
||||
if (!Lines || !Lines.len)
|
||||
if (!Lines)
|
||||
// Return dummy object for safety.
|
||||
return new/DBConnection()
|
||||
|
||||
for (var/name in Lines)
|
||||
var/value = Lines[name]
|
||||
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
|
||||
|
||||
name = lowertext(copytext(t, 1, pos))
|
||||
value = copytext(t, pos + 1)
|
||||
|
||||
if (!name)
|
||||
continue
|
||||
|
||||
if (name in data)
|
||||
data[name] = value
|
||||
|
||||
Reference in New Issue
Block a user