From 4c1860113f640efeb503505542393f3dccdd5060 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Tue, 12 Dec 2006 19:53:45 +0000 Subject: Tweaked stash-tracker so that greedy explore works in Pandemonium. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@621 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/files.cc | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'crawl-ref/source/files.cc') diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index 1eba6f40c5..fe39797abf 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -238,20 +238,20 @@ static bool is_uid_file(const std::string &name, const std::string &ext) } -static bool is_save_file_name(const std::string &name) +bool is_save_file_name(const std::string &name) { return is_uid_file(name, ".sav"); } #ifdef LOAD_UNPACKAGE_CMD -static bool is_packed_save(const std::string &name) +bool is_packed_save(const std::string &name) { return is_uid_file(name, PACKAGE_SUFFIX); } #endif // Returns a full player struct read from the save. -static player read_character_info(const std::string &savefile) +player read_character_info(const std::string &savefile) { player fromfile; player backup = you; @@ -263,24 +263,21 @@ static player read_character_info(const std::string &savefile) char majorVersion = 0; char minorVersion = 0; - if (!determine_version(charf, majorVersion, minorVersion)) - goto done_reading_character; - - if (majorVersion != SAVE_MAJOR_VERSION) - goto done_reading_character; - - restore_tagged_file(charf, TAGTYPE_PLAYER_NAME, minorVersion); - fromfile = you; - you = backup; + if (determine_version(charf, majorVersion, minorVersion) + && majorVersion == SAVE_MAJOR_VERSION) + { + restore_tagged_file(charf, TAGTYPE_PLAYER_NAME, minorVersion); + fromfile = you; + you = backup; + } -done_reading_character: fclose(charf); return fromfile; } // Returns the names of all files in the given directory. Note that the // filenames returned are relative to the directory. -static std::vector get_dir_files(const std::string &dirname) +std::vector get_dir_files(const std::string &dirname) { std::vector files; @@ -446,13 +443,14 @@ std::string get_savedir_path(const std::string &shortpath) */ std::vector find_saved_characters() { + std::vector chars; +#ifndef DISABLE_SAVEGAME_LISTS std::string searchpath = Options.save_dir; if (searchpath.empty()) searchpath = "."; std::vector allfiles = get_dir_files(searchpath); - std::vector chars; for (int i = 0, size = allfiles.size(); i < size; ++i) { std::string filename = allfiles[i]; @@ -495,6 +493,7 @@ std::vector find_saved_characters() } std::sort(chars.begin(), chars.end()); +#endif // !DISABLE_SAVEGAME_LISTS return (chars); } -- cgit v1.2.3-54-g00ecf