summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/files.h
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-24 16:27:58 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-24 16:27:58 +0000
commit93f5fdd067279f953af9440fa7c712985e6ecf34 (patch)
tree177f36448c1dbeedf772d627e654714c704d6b22 /crawl-ref/source/files.h
parentc633d5d2b956aab18819d51236982db57ee17134 (diff)
downloadcrawl-ref-93f5fdd067279f953af9440fa7c712985e6ecf34.tar.gz
crawl-ref-93f5fdd067279f953af9440fa7c712985e6ecf34.zip
Implemented .des file caching (speeds startup a fair bit): .des files are
parsed only once (unless they're modified again). Crawl also keeps only map stubs in memory (name, place, orient, tags) and loads the map body only when it is actually selected by the dungeon builder. This probably breaks the Windows build, will be fixed soonish. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1637 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/files.h')
-rw-r--r--crawl-ref/source/files.h28
1 files changed, 16 insertions, 12 deletions
diff --git a/crawl-ref/source/files.h b/crawl-ref/source/files.h
index c32cc52561..c210a1d534 100644
--- a/crawl-ref/source/files.h
+++ b/crawl-ref/source/files.h
@@ -30,7 +30,8 @@ std::string datafile_path(std::string basename,
bool croak_on_fail = true,
bool test_base_path = false);
std::string get_parent_directory(const std::string &filename);
-bool check_dir(const std::string &what, std::string &dir);
+std::string get_base_filename(const std::string &filename);
+bool check_dir(const std::string &what, std::string &dir, bool silent = false);
bool travel_load_map( branch_type branch, int absdepth );
@@ -42,8 +43,15 @@ std::string get_savedir_filename(const std::string &pre,
const std::string &ext,
bool suppress_uid = false);
std::string get_savedir_path(const std::string &shortpath);
-
std::string get_prefs_filename();
+std::string change_file_extension(const std::string &file,
+ const std::string &ext);
+
+time_t file_modtime(const std::string &file);
+bool is_newer(const std::string &a, const std::string &b);
+void check_newer(const std::string &target,
+ const std::string &dependency,
+ void (*action)());
bool load( int stair_taken, load_mode_type load_mode, bool was_a_labyrinth,
int old_level, branch_type where_were_you2 );
@@ -52,7 +60,7 @@ bool load( int stair_taken, load_mode_type load_mode, bool was_a_labyrinth,
/* ***********************************************************************
* called from: acr - misc
* *********************************************************************** */
-void save_game(bool leave_game);
+void save_game(bool leave_game, const char *bye = NULL);
// Save game without exiting (used when changing levels).
void save_game_state();
@@ -77,20 +85,16 @@ void save_ghost( bool force = false );
std::string make_filename( const char *prefix, int level, branch_type branch,
level_area_type lt, bool isGhost );
-void writeShort(FILE *file, short s);
+// Default cap on strings marshalled.
+#define STR_CAP 1000
+void writeShort(FILE *file, short s);
short readShort(FILE *file);
-
void writeByte(FILE *file, unsigned char byte);
-
unsigned char readByte(FILE *file);
-
-void writeString(FILE* file, const std::string &s, int cap = 200);
-
-std::string readString(FILE *file);
-
+void writeString(FILE* file, const std::string &s, int cap = STR_CAP);
+std::string readString(FILE *file, int cap = STR_CAP);
void writeLong(FILE* file, long num);
-
long readLong(FILE *file);
FILE *lk_open(const char *mode, const std::string &file);