summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/dat/portal.des20
-rw-r--r--crawl-ref/source/hiscores.cc7
-rw-r--r--crawl-ref/source/libutil.cc8
-rw-r--r--crawl-ref/source/libutil.h2
-rw-r--r--crawl-ref/source/output.cc4
-rw-r--r--crawl-ref/source/place.cc21
6 files changed, 45 insertions, 17 deletions
diff --git a/crawl-ref/source/dat/portal.des b/crawl-ref/source/dat/portal.des
index 5502c7d75b..b69b555417 100644
--- a/crawl-ref/source/dat/portal.des
+++ b/crawl-ref/source/dat/portal.des
@@ -17,6 +17,16 @@
#
##############################################################################
+{{
+
+function sewer_portal(e)
+ e.marker([[O = lua:one_way_stair { desc = "A glowing drain",
+ dst = "sewer", floor = "stone_arch" }]])
+ e.kfeat("O = enter_portal_vault")
+ e.colour("O = lightgreen")
+end
+
+}}
#############################################################################
#
@@ -30,10 +40,7 @@
NAME: portal_sewer_entry_a
TAGS: uniq_sewer_entry no_monster_gen mini_float
DEPTH: D:3-7
-MARKER: O = lua:one_way_stair { desc = "A glowing drain", \
- dst = "sewer" }
-KFEAT: O = enter_portal_vault
-COLOUR: O = lightgreen
+: sewer_portal(_G)
COLOUR: W = green / cyan w:5
SUBST: 1 = 11234444444444
MONS: rat / grey rat / green rat w:5
@@ -56,10 +63,7 @@ NAME: portal_sewer_entry_b
TAGS: uniq_sewer_entry no_monster_gen
ORIENT: float
DEPTH: D:3-7
-MARKER: O = lua:one_way_stair { desc = "A glowing drain", \
- dst = "sewer" }
-KFEAT: O = enter_portal_vault
-COLOUR: O = lightgreen
+: sewer_portal(_G)
SUBST: '=W. , W=WW1
KMONS: 1 = rat w:20 / grey rat w:20 / green rat/ small snake / snake w:2 / \
giant cockroach / giant mite / worm w:3
diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc
index 65e2151cb9..5a8b5ebf48 100644
--- a/crawl-ref/source/hiscores.cc
+++ b/crawl-ref/source/hiscores.cc
@@ -663,9 +663,16 @@ void scorefile_entry::set_base_xlog_fields() const
skill_title( best_skill, best_skill_lvl,
race, str, dex, god ).c_str() );
+ // "place" is a human readable place name, and it is write-only,
+ // so we can write place names like "Bazaar" that Crawl cannot
+ // translate back. This does have the unfortunate side-effect that
+ // Crawl will not preserve the "place" field in the highscores file.
fields->add_field("place", "%s",
place_name(get_packed_place(branch, dlvl, level_type),
false, true).c_str());
+
+ // Note: "br", "lvl" and "ltyp" are saved in canonical names that
+ // can be read back by future versions of Crawl.
fields->add_field("br", "%s", _short_branch_name(branch));
fields->add_field("lvl", "%d", dlvl);
fields->add_field("ltyp", "%s", level_area_type_name(level_type));
diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc
index 1be3303110..7d06e22c5f 100644
--- a/crawl-ref/source/libutil.cc
+++ b/crawl-ref/source/libutil.cc
@@ -158,6 +158,13 @@ std::string &uppercase(std::string &s)
return (s);
}
+std::string upcase_first(std::string s)
+{
+ if (!s.empty())
+ s[0] = toupper(s[0]);
+ return (s);
+}
+
std::string &lowercase(std::string &s)
{
for (unsigned i = 0, sz = s.size(); i < sz; ++i)
@@ -809,4 +816,3 @@ bool pattern_match(void *compiled_pattern, const char *text, int length)
#endif
mouse_mode mouse_control::ms_current_mode = MOUSE_MODE_NORMAL;
-
diff --git a/crawl-ref/source/libutil.h b/crawl-ref/source/libutil.h
index e3a0f06105..4be7ec41d6 100644
--- a/crawl-ref/source/libutil.h
+++ b/crawl-ref/source/libutil.h
@@ -31,6 +31,8 @@ description_level_type description_type_by_name(const char *desc);
std::string lowercase_string(std::string s);
std::string &lowercase(std::string &s);
std::string &uppercase(std::string &s);
+std::string upcase_first(std::string);
+
bool ends_with(const std::string &s, const std::string &suffix);
// String "tags"
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 59d4daf10e..2dbc1a9649 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -893,8 +893,8 @@ static std::string _level_description_string_hud()
else if (place.level_type == LEVEL_PORTAL_VAULT
|| place.level_type == LEVEL_LABYRINTH)
{
- if (you.level_type_name == "bazaar")
- short_name = "A Bazaar";
+ if (!you.level_type_name.empty())
+ short_name = article_a(upcase_first(you.level_type_name), false);
else
short_name.insert(0, "A ");
}
diff --git a/crawl-ref/source/place.cc b/crawl-ref/source/place.cc
index 2c3683a1fa..7e13141cc9 100644
--- a/crawl-ref/source/place.cc
+++ b/crawl-ref/source/place.cc
@@ -84,12 +84,21 @@ std::string place_name( unsigned short place, bool long_name,
case LEVEL_LABYRINTH:
return ( long_name ? "a Labyrinth" : "Lab" );
case LEVEL_PORTAL_VAULT:
- // FIXME: While there are no further portal vaults, declare all
- // portal vaults as bazaars.
-// if (you.level_type_name == "bazaar")
- return ( long_name ? "a Bazaar" : "Bazaar" );
-
-// return ( long_name ? "a Portal Chamber" : "Port" );
+ // 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.
+ if (branch == you.level_type
+ && !you.level_type_name.empty())
+ {
+ return long_name
+ ? article_a(you.level_type_name)
+ : upcase_first(you.level_type_name);
+ }
+ else
+ {
+ return long_name ? "a Portal Chamber" : "Port";
+ }
default:
return ( long_name ? "Buggy Badlands" : "Bug" );
}