summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tags.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-08 20:40:24 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-08 20:40:24 +0000
commitb31338b60aefb79b5d31e7bd1e3573c5965047e3 (patch)
tree2f406ecb6e20d62bcac6682636f15f9fd3744ecb /crawl-ref/source/tags.cc
parenta1b5f79cc172bddee8b225cd5a6726f6a5451666 (diff)
downloadcrawl-ref-b31338b60aefb79b5d31e7bd1e3573c5965047e3.tar.gz
crawl-ref-b31338b60aefb79b5d31e7bd1e3573c5965047e3.zip
New key=value logfile format as proposed by Shawn Moore. This is more verbose
than the old format by about 2x, but is more maintainable and comprehensible. Removed support for parsing scorefiles/logfiles older than 4.0 beta 26. Added shim to make 0.1.7 logfiles compatible with 0.2 Using the -scorefile option alone (no -scores, -tscores, etc.) causes Crawl to read in the existing scorefile/logfile and write it out to stdout in the new format. Ghouls get claw damage messages in unarmed combat. Plain oozes lose acid damage attacks (added inadvertently). Prompt the user when trying to displace a friendly over water (the old fix was to simply say "The foo resists"). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@994 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tags.cc')
-rw-r--r--crawl-ref/source/tags.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 6655fec60b..a95aad09d4 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -350,22 +350,25 @@ bool unmarshallBoolean(struct tagHeader &th)
}
// Saving the date as a string so we're not reliant on a particular epoch.
-void make_date_string( time_t in_date, char buff[20] )
+std::string make_date_string( time_t in_date )
{
+ char buff[20];
+
if (in_date <= 0)
{
buff[0] = 0;
- return;
+ return (buff);
}
-
struct tm *date = localtime( &in_date );
- snprintf( buff, 20,
+ snprintf( buff, sizeof buff,
"%4d%02d%02d%02d%02d%02d%s",
date->tm_year + 1900, date->tm_mon, date->tm_mday,
date->tm_hour, date->tm_min, date->tm_sec,
((date->tm_isdst > 0) ? "D" : "S") );
+
+ return (buff);
}
static int get_val_from_string( const char *ptr, int len )
@@ -613,7 +616,6 @@ void tag_set_expected(char tags[], int fileType)
// --------------------------- player tags (foo.sav) -------------------- //
static void tag_construct_you(struct tagHeader &th)
{
- char buff[20]; // used for date string
int i,j;
marshallString(th, you.your_name, 30);
@@ -776,8 +778,7 @@ static void tag_construct_you(struct tagHeader &th)
marshallByte(th, you.wizard);
// time of game start
- make_date_string( you.birth_time, buff );
- marshallString(th, buff, 20);
+ marshallString(th, make_date_string( you.birth_time ).c_str(), 20);
// real_time == -1 means game was started before this feature
if (you.real_time != -1)