mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Fixes savefiles deleting themselves every new round. Sorry ;_;
Ironically it was the thing I coded to update old savefiles that was ruining everything. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5159 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -7,10 +7,9 @@
|
|||||||
//this will mean that savefile_version will still be over SAVEFILE_VERSION_MIN, meaning
|
//this will mean that savefile_version will still be over SAVEFILE_VERSION_MIN, meaning
|
||||||
//this savefile update doesn't run everytime we load from the savefile.
|
//this savefile update doesn't run everytime we load from the savefile.
|
||||||
//This is mainly for format changes, such as the bitflags in toggles changing order or something.
|
//This is mainly for format changes, such as the bitflags in toggles changing order or something.
|
||||||
|
//if a file can't be updated, return 0 to delete it and start again
|
||||||
|
//if a file was updated, return 1
|
||||||
/datum/preferences/proc/savefile_update()
|
/datum/preferences/proc/savefile_update()
|
||||||
if(savefile_version < 6) //really old savefile.
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if(savefile_version < 8) //lazily delete everything + additional files so they can be saved in the new format
|
if(savefile_version < 8) //lazily delete everything + additional files so they can be saved in the new format
|
||||||
for(var/ckey in preferences_datums)
|
for(var/ckey in preferences_datums)
|
||||||
var/datum/preferences/D = preferences_datums[ckey]
|
var/datum/preferences/D = preferences_datums[ckey]
|
||||||
@@ -20,11 +19,10 @@
|
|||||||
fdel(delpath)
|
fdel(delpath)
|
||||||
break
|
break
|
||||||
savefile_version = 8
|
savefile_version = 8
|
||||||
|
save_preferences()
|
||||||
//save format changes
|
save_character()
|
||||||
save_preferences()
|
return 1
|
||||||
save_character()
|
return 0
|
||||||
return 1
|
|
||||||
|
|
||||||
/datum/preferences/proc/load_path(ckey,filename="preferences.sav")
|
/datum/preferences/proc/load_path(ckey,filename="preferences.sav")
|
||||||
if(!ckey) return
|
if(!ckey) return
|
||||||
@@ -39,8 +37,11 @@
|
|||||||
S["version"] >> savefile_version
|
S["version"] >> savefile_version
|
||||||
//Conversion
|
//Conversion
|
||||||
if(!savefile_version || !isnum(savefile_version) || savefile_version < SAVEFILE_VERSION_MIN || savefile_version > SAVEFILE_VERSION_MAX)
|
if(!savefile_version || !isnum(savefile_version) || savefile_version < SAVEFILE_VERSION_MIN || savefile_version > SAVEFILE_VERSION_MAX)
|
||||||
if(!savefile_update())
|
if(!savefile_update()) //handles updates
|
||||||
fdel(path)
|
fdel(path) //handles deleting old files for which an update clause has not been defined
|
||||||
|
savefile_version = SAVEFILE_VERSION_MAX
|
||||||
|
save_preferences()
|
||||||
|
save_character()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
//general preferences
|
//general preferences
|
||||||
|
|||||||
@@ -44,8 +44,6 @@
|
|||||||
else
|
else
|
||||||
world.log << "Tgstation database connection established."
|
world.log << "Tgstation database connection established."
|
||||||
|
|
||||||
sleep(50)
|
|
||||||
|
|
||||||
plmaster = new /obj/effect/overlay( )
|
plmaster = new /obj/effect/overlay( )
|
||||||
plmaster.icon = 'icons/effects/tile_effects.dmi'
|
plmaster.icon = 'icons/effects/tile_effects.dmi'
|
||||||
plmaster.icon_state = "plasma"
|
plmaster.icon_state = "plasma"
|
||||||
|
|||||||
Reference in New Issue
Block a user