summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/maps.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-02-24 06:08:10 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-02-24 06:08:10 +0100
commit2521a5a6b850abb304e5127ddb51e42c132ab9b4 (patch)
tree34cb4d89039c22a86f1a91ed37b3f575592a4e7a /crawl-ref/source/maps.cc
parent78bee588c59502f03ad122a52a5be3958e35db5c (diff)
downloadcrawl-ref-2521a5a6b850abb304e5127ddb51e42c132ab9b4.tar.gz
crawl-ref-2521a5a6b850abb304e5127ddb51e42c132ab9b4.zip
Simplify a variable's scope.
Diffstat (limited to 'crawl-ref/source/maps.cc')
-rw-r--r--crawl-ref/source/maps.cc29
1 files changed, 13 insertions, 16 deletions
diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc
index d1741f0872..36c46c9ffc 100644
--- a/crawl-ref/source/maps.cc
+++ b/crawl-ref/source/maps.cc
@@ -1215,26 +1215,23 @@ static bool _load_map_index(const string& cache, const string &base,
time_t mtime)
{
// If there's a global prelude, load that first.
+ if (FILE *fp = fopen_u((base + ".lux").c_str(), "rb"))
{
- FILE *fp = fopen_u((base + ".lux").c_str(), "rb");
- if (fp)
+ reader inf(fp, TAG_MINOR_VERSION);
+ uint8_t major = unmarshallUByte(inf);
+ uint8_t minor = unmarshallUByte(inf);
+ int8_t word = unmarshallByte(inf);
+ int64_t t = unmarshallSigned(inf);
+ if (major != TAG_MAJOR_VERSION || minor > TAG_MINOR_VERSION
+ || word != WORD_LEN || t != mtime)
{
- reader inf(fp, TAG_MINOR_VERSION);
- uint8_t major = unmarshallUByte(inf);
- uint8_t minor = unmarshallUByte(inf);
- int8_t word = unmarshallByte(inf);
- int64_t t = unmarshallSigned(inf);
- if (major != TAG_MAJOR_VERSION || minor > TAG_MINOR_VERSION
- || word != WORD_LEN || t != mtime)
- {
- return false;
- }
+ return false;
+ }
- lc_global_prelude.read(inf);
- fclose(fp);
+ lc_global_prelude.read(inf);
+ fclose(fp);
- global_preludes.push_back(lc_global_prelude);
- }
+ global_preludes.push_back(lc_global_prelude);
}
FILE* fp = fopen_u((base + ".idx").c_str(), "rb");