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/place.cc | |
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/place.cc')
-rw-r--r-- | crawl-ref/source/place.cc | 22 |
1 files changed, 14 insertions, 8 deletions
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 { |