summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/package.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2011-01-07 14:00:56 +0100
committerAdam Borowski <kilobyte@angband.pl>2011-01-07 14:00:56 +0100
commit95d7f0cd5adbcf230d64aa2ee1ecda8ce9c80768 (patch)
treee0305946de1c5c93f1e1aac3349d7a351392483c /crawl-ref/source/package.cc
parent25929773cf6db6860fbbbf901650e7e34569c41c (diff)
downloadcrawl-ref-95d7f0cd5adbcf230d64aa2ee1ecda8ce9c80768.tar.gz
crawl-ref-95d7f0cd5adbcf230d64aa2ee1ecda8ce9c80768.zip
Allow handling old save package formats.
Diffstat (limited to 'crawl-ref/source/package.cc')
-rw-r--r--crawl-ref/source/package.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/crawl-ref/source/package.cc b/crawl-ref/source/package.cc
index bd98d97512..cc77785f01 100644
--- a/crawl-ref/source/package.cc
+++ b/crawl-ref/source/package.cc
@@ -67,8 +67,8 @@ static len_t htole(len_t x)
struct file_header
{
- int32_t magic;
- int8_t version;
+ uint32_t magic;
+ uint8_t version;
char padding[3];
len_t start;
};
@@ -151,14 +151,14 @@ void package::load()
if (htole(head.magic) != PACKAGE_MAGIC)
fail("save file (%s) corrupted -- not a DCSS save file",
filename.c_str());
- if (head.version != PACKAGE_VERSION)
+ if (head.version > PACKAGE_VERSION)
fail("save file (%s) uses an unknown format %u", filename.c_str(),
head.version);
off_t len = lseek(fd, 0, SEEK_END);
if (len == -1)
sysfail("save file (%s) is not seekable", filename.c_str());
file_len = len;
- read_directory(htole(head.start));
+ read_directory(htole(head.start), head.version);
if (rw)
{
@@ -457,7 +457,7 @@ void package::fsck()
file_len = save_file_len;
}
-void package::read_directory(len_t start)
+void package::read_directory(len_t start, uint8_t version)
{
ASSERT(directory.empty());
directory[""] = start;