Preferences fixes, ahoy! (#3045)

Fixes #1670
Fixes #1780
Fixes #1781
Fixes #1493
This commit is contained in:
Erki Meinberg
2017-07-21 20:50:59 +03:00
committed by GitHub
parent ee503f015f
commit 283f63d098
15 changed files with 71 additions and 59 deletions
@@ -34,13 +34,13 @@
/datum/category_group/player_setup_category/global_preferences
name = "Global"
sort_order = 5
sort_order = 6
category_item_type = /datum/category_item/player_setup_item/player_global
sql_role = SQL_PREFERENCES
/datum/category_group/player_setup_category/other_preferences
name = "Other"
sort_order = 6
sort_order = 7
category_item_type = /datum/category_item/player_setup_item/other
/****************************
@@ -61,9 +61,9 @@
selected_category = null
return ..()
/datum/category_collection/player_setup_collection/proc/sanitize_setup()
/datum/category_collection/player_setup_collection/proc/sanitize_setup(sql_load = FALSE)
for(var/datum/category_group/player_setup_category/PS in categories)
PS.sanitize_setup()
PS.sanitize_setup(sql_load)
/datum/category_collection/player_setup_collection/proc/load_character(var/savefile/S)
for(var/datum/category_group/player_setup_category/PS in categories)
@@ -122,11 +122,11 @@
var/sql_role = SQL_CHARACTER
var/modified = 0
/datum/category_group/player_setup_category/proc/sanitize_setup()
/datum/category_group/player_setup_category/proc/sanitize_setup(sql_load = FALSE)
for(var/datum/category_item/player_setup_item/PI in items)
PI.sanitize_preferences()
PI.sanitize_preferences(sql_load)
for(var/datum/category_item/player_setup_item/PI in items)
PI.sanitize_character()
PI.sanitize_character(sql_load)
/datum/category_group/player_setup_category/proc/load_character(var/savefile/S)
// Load all data, then sanitize it.
@@ -150,11 +150,10 @@
if (!config.sql_saves || !establish_db_connection(dbcon))
for (var/datum/category_item/player_setup_item/PI in items)
PI.save_character(S)
else
if (modified)
// No save here, because this is only called from the menu and needs to save /everything/.
handle_sql_saving(SQL_CHARACTER)
modified = 0
else if (modified)
// No save here, because this is only called from the menu and needs to save /everything/.
handle_sql_saving(SQL_CHARACTER)
modified = 0
/datum/category_group/player_setup_category/proc/load_preferences(var/savefile/S)
if (!config.sql_saves || !establish_db_connection(dbcon))