mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 12:29:46 +01:00
Fixes Boogaloo (#1345)
Re-adds IPC APC feeding Removes more of the horror that is type paths in text strings when they don't have to be there :ree: Fix a bunch of lore blurbs SQL saving is fixededed Mark-up REGEX now requires whitespace or line ending/starts between tokens. It doesn't grab tokens surrounded by non-whitespace characters. Updated the server greeting to only updated saved hashes if a user actively clicks on a tab. C4 now forces old system for itself, due to raisins. Admin verb to toggle between global default explosion type. One round only. Requires R_DEBUG or R_SERVER, is hideable.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
// These are not flags, binary operations not intended
|
||||
#define TOPIC_NOACTION 0
|
||||
#define TOPIC_HANDLED 1
|
||||
#define TOPIC_REFRESH 2
|
||||
#define TOPIC_NOACTION 0
|
||||
#define TOPIC_HANDLED 1
|
||||
#define TOPIC_REFRESH 2
|
||||
|
||||
#define SQL_CHARACTER 1
|
||||
#define SQL_PREFERENCES 2
|
||||
// These are bitflags. Use wisely.
|
||||
#define SQL_CHARACTER 0x1
|
||||
#define SQL_PREFERENCES 0x2
|
||||
|
||||
/datum/category_group/player_setup_category/general_preferences
|
||||
name = "General"
|
||||
@@ -150,7 +151,7 @@
|
||||
else
|
||||
if (modified)
|
||||
// No save here, because this is only called from the menu and needs to save /everything/.
|
||||
handle_sql_saving(0)
|
||||
handle_sql_saving(SQL_PREFERENCES|SQL_CHARACTER)
|
||||
modified = 0
|
||||
|
||||
/datum/category_group/player_setup_category/proc/load_preferences(var/savefile/S)
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
// Set this to 1 if you want to debug the SQL saves.
|
||||
// I got tired as hell from writing these debug lines and deleting them later.
|
||||
#define SQL_PREF_DEBUG 0
|
||||
|
||||
/*
|
||||
* A proc for dynamically loading a character from the database.
|
||||
* See the category items for procs on what pieces are given.
|
||||
@@ -8,7 +12,10 @@
|
||||
var/static/list/query_cache
|
||||
|
||||
// We aren't loading this category. Bye.
|
||||
if (role_type && sql_role != role_type)
|
||||
if (role_type && !(sql_role & role_type))
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER LOAD: Bad role_type, returned. Looking for: [role_type], had: [sql_role]. Conjunction: [sql_role & role_type].")
|
||||
#endif
|
||||
return
|
||||
|
||||
if (isnull(query_cache))
|
||||
@@ -72,6 +79,9 @@
|
||||
else
|
||||
query += ";"
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER LOAD: Cached query [query] with variables [json_encode(var_names)]")
|
||||
#endif
|
||||
// Save it.
|
||||
query_cache[type][query] = var_names
|
||||
|
||||
@@ -80,6 +90,11 @@
|
||||
|
||||
// Actually utilize the queries.
|
||||
var/list/arg_list = gather_load_parameters()
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER LOAD: Started loading with arguments: [json_encode(arg_list)]. Role type: [role_type]")
|
||||
#endif
|
||||
|
||||
for (var/query_text in query_cache[type])
|
||||
var/DBQuery/query = dbcon.NewQuery(query_text)
|
||||
query.Execute(arg_list, 1)
|
||||
@@ -88,6 +103,11 @@
|
||||
log_debug("SQL CHARACTER LOAD: SQL query error: [query.ErrorMsg()]")
|
||||
log_debug("SQL CHARACTER LOAD: query args: [json_encode(arg_list)]")
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
else
|
||||
log_debug("SQL CHARACTER LOAD: Successfully executed query: [query_text]")
|
||||
#endif
|
||||
|
||||
continue
|
||||
|
||||
// Each query should only return exactly 1 row.
|
||||
@@ -122,7 +142,10 @@
|
||||
var/static/list/query_cache
|
||||
|
||||
// We aren't loading this category. Bye.
|
||||
if (role_type && sql_role != role_type)
|
||||
if (role_type && !(sql_role & role_type))
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER SAVE: Bad role_type, returned. Looking for: [role_type], had: [sql_role]. Conjunction: [sql_role & role_type].")
|
||||
#endif
|
||||
return
|
||||
|
||||
if (isnull(query_cache))
|
||||
@@ -175,12 +198,20 @@
|
||||
// Remove any potentially damaging commas from the end.
|
||||
query = replacetext(query, ",", "", length(query) - 1)
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER SAVE: Cached query [query].")
|
||||
#endif
|
||||
|
||||
// Save it.
|
||||
query_cache[type] += query
|
||||
|
||||
// Actually utilize the queries.
|
||||
var/list/arg_list = gather_save_parameters()
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER SAVE: Started saving with arguments: [json_encode(arg_list)]. Role type: [role_type]")
|
||||
#endif
|
||||
|
||||
// Typecast the collection so we can access its preferences var.
|
||||
var/datum/category_collection/player_setup_collection/cc = collection
|
||||
for (var/query_text in query_cache[type])
|
||||
@@ -194,7 +225,12 @@
|
||||
|
||||
continue
|
||||
|
||||
if (role_type == SQL_CHARACTER && !cc.preferences.current_character)
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
else
|
||||
log_debug("SQL CHARACTER SAVE: Successfully executed query: [query_text]")
|
||||
#endif
|
||||
|
||||
if ((role_type & SQL_CHARACTER) && !cc.preferences.current_character)
|
||||
// No current character, means we're doing insert queries.
|
||||
// Quickly nab the new ID and substitute it within the args.
|
||||
query = dbcon.NewQuery("SELECT LAST_INSERT_ID() AS new_id")
|
||||
@@ -204,6 +240,11 @@
|
||||
arg_list[":id"] = text2num(query.item[1])
|
||||
arg_list[":char_id"] = text2num(query.item[1])
|
||||
cc.preferences.current_character = text2num(query.item[1])
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER SAVE: Successfully set character ID to [cc.preferences.current_character]")
|
||||
#endif
|
||||
|
||||
else
|
||||
error("SQL CHARACTER SAVE: New ID was not recovered.")
|
||||
log_debug("SQL CHARACTER SAVE: New ID was not recovered.")
|
||||
@@ -217,3 +258,5 @@
|
||||
arg_list |= PI.gather_save_parameters()
|
||||
|
||||
return arg_list
|
||||
|
||||
#undef SQL_PREF_DEBUG
|
||||
|
||||
Reference in New Issue
Block a user