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:
elly1989@rocketmail.com
2012-11-22 08:06:16 +00:00
parent 13c2f29555
commit b36ddfae98
2 changed files with 11 additions and 12 deletions

View File

@@ -7,10 +7,9 @@
//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 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()
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
for(var/ckey in preferences_datums)
var/datum/preferences/D = preferences_datums[ckey]
@@ -20,11 +19,10 @@
fdel(delpath)
break
savefile_version = 8
//save format changes
save_preferences()
save_character()
return 1
save_preferences()
save_character()
return 1
return 0
/datum/preferences/proc/load_path(ckey,filename="preferences.sav")
if(!ckey) return
@@ -39,8 +37,11 @@
S["version"] >> savefile_version
//Conversion
if(!savefile_version || !isnum(savefile_version) || savefile_version < SAVEFILE_VERSION_MIN || savefile_version > SAVEFILE_VERSION_MAX)
if(!savefile_update())
fdel(path)
if(!savefile_update()) //handles updates
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
//general preferences

View File

@@ -44,8 +44,6 @@
else
world.log << "Tgstation database connection established."
sleep(50)
plmaster = new /obj/effect/overlay( )
plmaster.icon = 'icons/effects/tile_effects.dmi'
plmaster.icon_state = "plasma"