summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/files.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-12 19:53:45 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-12 19:53:45 +0000
commit4c1860113f640efeb503505542393f3dccdd5060 (patch)
treee28485e52508608a7823fa389f2354b44d717a06 /crawl-ref/source/files.cc
parent170c1de4d2bc1b996f11cffdec0fc49cfe71c388 (diff)
downloadcrawl-ref-4c1860113f640efeb503505542393f3dccdd5060.tar.gz
crawl-ref-4c1860113f640efeb503505542393f3dccdd5060.zip
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
Diffstat (limited to 'crawl-ref/source/files.cc')
-rw-r--r--crawl-ref/source/files.cc29
1 files changed, 14 insertions, 15 deletions
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<std::string> get_dir_files(const std::string &dirname)
+std::vector<std::string> get_dir_files(const std::string &dirname)
{
std::vector<std::string> files;
@@ -446,13 +443,14 @@ std::string get_savedir_path(const std::string &shortpath)
*/
std::vector<player> find_saved_characters()
{
+ std::vector<player> chars;
+#ifndef DISABLE_SAVEGAME_LISTS
std::string searchpath = Options.save_dir;
if (searchpath.empty())
searchpath = ".";
std::vector<std::string> allfiles = get_dir_files(searchpath);
- std::vector<player> chars;
for (int i = 0, size = allfiles.size(); i < size; ++i)
{
std::string filename = allfiles[i];
@@ -495,6 +493,7 @@ std::vector<player> find_saved_characters()
}
std::sort(chars.begin(), chars.end());
+#endif // !DISABLE_SAVEGAME_LISTS
return (chars);
}