diff options
author | Jude Brown <bookofjude@users.sourceforge.net> | 2009-12-05 16:30:33 +1000 |
---|---|---|
committer | Jude Brown <bookofjude@users.sourceforge.net> | 2009-12-05 16:30:33 +1000 |
commit | 5676812f1b549d28736a7e6ffc25f36f40309a33 (patch) | |
tree | ec490543495f21c54a22545e7a2c5a234bdf22d3 /crawl-ref/source | |
parent | 01c241d0589cd53226c71eea517392ed3a442b26 (diff) | |
download | crawl-ref-5676812f1b549d28736a7e6ffc25f36f40309a33.tar.gz crawl-ref-5676812f1b549d28736a7e6ffc25f36f40309a33.zip |
Properly use you.level_type_origin instead.
When changing levels and generating a note, misc.cc uses
you.level_type_origin. place_name uses you.level_type__name instead. As
you.level_type_origin is set to a variant of you.level_type_name, use
that instead! That makes no sense.
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/misc.cc | 15 | ||||
-rw-r--r-- | crawl-ref/source/place.cc | 22 |
2 files changed, 18 insertions, 19 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 8366466171..1460170e52 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -2655,17 +2655,10 @@ void new_level(void) { if (you.level_type == LEVEL_PORTAL_VAULT) { - // If there's more than one word in level_type_origin then skip - // the first, since it's most likely a preposition. - std::string desc = "Entered "; - size_t space = you.level_type_origin.find(" "); - if (space == std::string::npos) - desc += you.level_type_origin; - else - desc += you.level_type_origin.substr(space + 1); - desc += "."; - - take_note(Note(NOTE_DUNGEON_LEVEL_CHANGE, 0, 0, NULL, + // This here because place_name can't find the name of a level that you + // *are no longer on* when it spits out the new notes list. + std::string desc = "Entered " + place_name(get_packed_place(), true, true); + take_note(Note(NOTE_DUNGEON_LEVEL_CHANGE, 0, 0, NULL, desc.c_str())); } else diff --git a/crawl-ref/source/place.cc b/crawl-ref/source/place.cc index 2064fb0dfb..a07929b723 100644 --- a/crawl-ref/source/place.cc +++ b/crawl-ref/source/place.cc @@ -83,16 +83,22 @@ std::string place_name( unsigned short place, bool long_name, case LEVEL_LABYRINTH: return ( long_name ? "a Labyrinth" : "Lab" ); case LEVEL_PORTAL_VAULT: - // XXX: Using level_type_name here is strictly evil, but - // packed places lack the information needed for pretty-printing - // place names for portal vaults, so we must use this out-of-band - // information. + // XXX: This was originally in misc.cc:new_level. It really makes + // no sense for it to be there, as there are instances where portal + // vaults can use origin elsewhere (death messages, etc), and Note + // ::describe calls this anyway. (due) if (branch == you.level_type - && !you.level_type_name.empty()) + && !you.level_type_origin.empty()) { - return long_name - ? article_a(you.level_type_name) - : upcase_first(you.level_type_name_abbrev); + std::string desc; + + size_t space = you.level_type_origin.find(" "); + if (space == std::string::npos) + desc += you.level_type_origin; + else + desc += you.level_type_origin.substr(space + 1); + + return long_name ? desc : upcase_first(you.level_type_name_abbrev); } else { |