summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/notes.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2011-10-15 13:52:24 +0200
committerAdam Borowski <kilobyte@angband.pl>2011-11-04 18:49:49 +0100
commitc346361417241d0e4d7531ed65a1ca5b4f497139 (patch)
tree8c76c3b32dac858b2a36df7d032ff50e49545384 /crawl-ref/source/notes.cc
parentf4a9aed257bbdd264fb1ef43e7b29b3cc599cd65 (diff)
downloadcrawl-ref-c346361417241d0e4d7531ed65a1ca5b4f497139.tar.gz
crawl-ref-c346361417241d0e4d7531ed65a1ca5b4f497139.zip
Get rid of level_type, unify BRANCH_*, LEVEL_* and portal vaults.
Diffstat (limited to 'crawl-ref/source/notes.cc')
-rw-r--r--crawl-ref/source/notes.cc32
1 files changed, 16 insertions, 16 deletions
diff --git a/crawl-ref/source/notes.cc b/crawl-ref/source/notes.cc
index 230c3b3549..c4e8050206 100644
--- a/crawl-ref/source/notes.cc
+++ b/crawl-ref/source/notes.cc
@@ -85,7 +85,7 @@ static bool _is_noteworthy_dlevel(unsigned short place)
const int lev = (place & 0xFF);
// Special levels (Abyss, etc.) are always interesting.
- if (lev == 0xFF)
+ if (!is_connected_branch(static_cast<branch_type>(branch)))
return (true);
if (lev == _dungeon_branch_depth(branch)
@@ -177,13 +177,10 @@ static bool _is_noteworthy(const Note& note)
if (!_is_noteworthy_dlevel(note.packed_place))
return (false);
- // Labyrinths and portal vaults are always interesting.
- if ((note.packed_place & 0xFF) == 0xFF
- && ((note.packed_place >> 8) == LEVEL_LABYRINTH
- || (note.packed_place >> 8) == LEVEL_PORTAL_VAULT))
- {
+ level_id place = level_id::from_packed_place(note.packed_place);
+ // Non-persistent places are always interesting.
+ if (!is_connected_branch(place))
return (true);
- }
}
// Learning a spell is always noteworthy if note_all_spells is set.
@@ -256,12 +253,14 @@ std::string Note::describe(bool when, bool where, bool what) const
if (where)
{
+#if TAG_MAJOR_VERSION == 32
if (!place_abbrev.empty())
result << "| " << chop_string(place_abbrev, MAX_NOTE_PLACE_LEN)
<< " | ";
else
- result << "| " << chop_string(short_place_name(packed_place),
- MAX_NOTE_PLACE_LEN) << " | ";
+#endif
+ result << "| " << chop_string(short_place_name(packed_place),
+ MAX_NOTE_PLACE_LEN) << " | ";
}
if (what)
@@ -432,13 +431,13 @@ Note::Note()
{
turn = you.num_turns;
packed_place = get_packed_place();
-
- if (you.level_type == LEVEL_PORTAL_VAULT)
- place_abbrev = you.level_type_name_abbrev;
}
Note::Note(NOTE_TYPES t, int f, int s, const char* n, const char* d) :
- type(t), first(f), second(s), place_abbrev("")
+ type(t), first(f), second(s)
+#if TAG_MAJOR_VERSION == 32
+ , place_abbrev("")
+#endif
{
if (n)
name = std::string(n);
@@ -447,9 +446,6 @@ Note::Note(NOTE_TYPES t, int f, int s, const char* n, const char* d) :
turn = you.num_turns;
packed_place = get_packed_place();
-
- if (you.level_type == LEVEL_PORTAL_VAULT)
- place_abbrev = you.level_type_name_abbrev;
}
void Note::check_milestone() const
@@ -492,7 +488,9 @@ void Note::save(writer& outf) const
marshallInt(outf, first);
marshallInt(outf, second);
marshallString4(outf, name);
+#if TAG_MAJOR_VERSION == 32
marshallString4(outf, place_abbrev);
+#endif
marshallString4(outf, desc);
}
@@ -504,7 +502,9 @@ void Note::load(reader& inf)
first = unmarshallInt(inf);
second = unmarshallInt(inf);
unmarshallString4(inf, name);
+#if TAG_MAJOR_VERSION == 32
unmarshallString4(inf, place_abbrev);
+#endif
unmarshallString4(inf, desc);
}