summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/files.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-20 00:20:43 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-20 00:20:43 +0000
commit207f41de95938d15bca36a7b5b8872adabd78e2d (patch)
treeb287162b2c459ed2b5dc2a880b98a35f7f80c05d /crawl-ref/source/files.cc
parentb846daeeb21ef06b3da9e3c445a65c3611ef181d (diff)
downloadcrawl-ref-207f41de95938d15bca36a7b5b8872adabd78e2d.tar.gz
crawl-ref-207f41de95938d15bca36a7b5b8872adabd78e2d.zip
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
Diffstat (limited to 'crawl-ref/source/files.cc')
-rw-r--r--crawl-ref/source/files.cc26
1 files changed, 16 insertions, 10 deletions
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!