summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/ouch.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-15 11:26:00 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-15 11:26:00 +0000
commitdd6871b0fbac350ea175d88e5b2bc340a5fb6e30 (patch)
treea5d03236d042f9c52c095304f74a323452d82778 /crawl-ref/source/ouch.cc
parent80ff6b26122857839ec18211fae01b734618fd34 (diff)
downloadcrawl-ref-dd6871b0fbac350ea175d88e5b2bc340a5fb6e30.tar.gz
crawl-ref-dd6871b0fbac350ea175d88e5b2bc340a5fb6e30.zip
Added -morgue option to specify where morgues are saved.
Added -macro option to specify location of macro file. Morgue files are named morgue-<cname>-<time>.txt, provided Crawl is compiled without SHORT_FILE_NAMES. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@637 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/ouch.cc')
-rw-r--r--crawl-ref/source/ouch.cc25
1 files changed, 24 insertions, 1 deletions
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 433acb8ce6..a4a93a4383 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -804,6 +804,29 @@ void ouch( int dam, int death_source, char death_type, const char *aux )
end_game(se);
}
+static std::string morgue_name()
+{
+#ifdef SHORT_FILE_NAMES
+ return "morgue";
+#else // !SHORT_FILE_NAMES
+ std::string name = "morgue-" + std::string(you.your_name);
+ time_t when_crawl_got_even = time(NULL);
+
+ if (tm *loc = localtime(&when_crawl_got_even))
+ {
+ char buf[25];
+ snprintf(buf, sizeof buf, "-%04d%02d%02d-%02d%02d",
+ loc->tm_year + 1900,
+ loc->tm_mon + 1,
+ loc->tm_mday,
+ loc->tm_hour,
+ loc->tm_min);
+ name += buf;
+ }
+ return (name);
+#endif // SHORT_FILE_NAMES
+}
+
void end_game( struct scorefile_entry &se )
{
int i;
@@ -874,7 +897,7 @@ void end_game( struct scorefile_entry &se )
invent( -1, dead );
clrscr();
- if (!dump_char( "morgue", !dead, true ))
+ if (!dump_char( morgue_name(), !dead, true ))
mpr("Char dump unsuccessful! Sorry about that.");
#if DEBUG_DIAGNOSTICS
//jmf: switched logic and moved "success" message to debug-only