--- deliantra/Deliantra-Client/DC.pm 2012/01/18 00:51:22 1.214 +++ deliantra/Deliantra-Client/DC.pm 2012/01/18 13:42:19 1.215 @@ -189,13 +189,13 @@ } } -sub read_cfg { +sub read_cfg($) { my ($file) = @_; $::CFG = (load_json $file) || (load_json "$file.bak"); } -sub write_cfg { +sub write_cfg($) { my $file = "$Deliantra::VARDIR/client.cf"; $::CFG->{VERSION} = $::VERSION; @@ -210,6 +210,18 @@ rename "$file~", $file; } +sub load_cfg() { + if (-e "$Deliantra::VARDIR/client.cf") { + DC::read_cfg "$Deliantra::VARDIR/client.cf"; + } else { + $::CFG = {}; + } +} + +sub save_cfg() { + write_cfg "$Deliantra::VARDIR/client.cf"; +} + sub upgrade_cfg() { my %DEF_CFG = ( config_autosave => 1,