From 207f41de95938d15bca36a7b5b8872adabd78e2d Mon Sep 17 00:00:00 2001 From: haranp Date: Fri, 20 Feb 2009 00:20:43 +0000 Subject: For [2615112], add a hook for portal vault levels to override the default extension (ptl) for ghost filenames. This currently has no effect, as I don't know how to hook in Lua code; can someone who knows this better put in code to allow .des files to override this extension? [The idea is to give "suffix" a good value in _make_ghost_filename().] git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9135 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/files.cc | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'crawl-ref/source/files.cc') diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index 10833e6141..070076e706 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -1540,16 +1540,26 @@ void save_game_state() save_game(true); } +static std::string _make_ghost_filename() +{ + if (you.level_type == LEVEL_PORTAL_VAULT) + { + std::string suffix = "ptl"; + return get_savedir_filename("bones", "", suffix, true); + } + else + { + return make_filename("bones", you.your_level, you.where_are_you, + you.level_type, true); + } +} + void _load_ghost(void) { char majorVersion; char minorVersion; - std::string cha_fil = make_filename("bones", you.your_level, - you.where_are_you, - you.level_type, - true ); - + const std::string cha_fil = _make_ghost_filename(); FILE *gfile = fopen(cha_fil.c_str(), "rb"); if (gfile == NULL) @@ -1896,11 +1906,7 @@ void save_ghost( bool force ) return; } - std::string cha_fil = make_filename( "bones", you.your_level, - you.where_are_you, - you.level_type, - true ); - + const std::string cha_fil = _make_ghost_filename(); FILE *gfile = fopen(cha_fil.c_str(), "rb"); // Don't overwrite existing bones! -- cgit v1.2.3-54-g00ecf