summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dgn-overview.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2012-05-02 13:04:14 -0400
committerNeil Moore <neil@s-z.org>2012-05-02 22:37:29 -0400
commitd824ca89c52e0a5fcd2b9b7c41e4fea8da163710 (patch)
tree6c61d1f477a1e30cb47c8dd013872894f553ebe6 /crawl-ref/source/dgn-overview.cc
parent8ce0e0f77d0a67c6388dcd76203ab8c8ab676a59 (diff)
downloadcrawl-ref-d824ca89c52e0a5fcd2b9b7c41e4fea8da163710.tar.gz
crawl-ref-d824ca89c52e0a5fcd2b9b7c41e4fea8da163710.zip
Set ZotDef in Zot.
Allow games to use different root branches. Currently this is Zot for zotdef, and Dungeon for everything else. If there are reachable branches that precede the root branch in branches[], the ^O screen will incorrectly print them first. This is not currently the case for any game type, and isn't likely to be the case in the future, because branches[] is for the most part topologically sorted.
Diffstat (limited to 'crawl-ref/source/dgn-overview.cc')
-rw-r--r--crawl-ref/source/dgn-overview.cc32
1 files changed, 12 insertions, 20 deletions
diff --git a/crawl-ref/source/dgn-overview.cc b/crawl-ref/source/dgn-overview.cc
index 5b3455de05..a40fe01fa4 100644
--- a/crawl-ref/source/dgn-overview.cc
+++ b/crawl-ref/source/dgn-overview.cc
@@ -344,7 +344,7 @@ static std::string _get_seen_branches(bool display)
// Each branch entry takes up 26 spaces + 38 for tags.
const int width = 64;
- int num_printed_branches = 1;
+ int num_printed_branches = 0;
char buffer[100];
std::string disp;
@@ -356,23 +356,12 @@ static std::string _get_seen_branches(bool display)
}
disp += "\n";
- level_id dungeon_lid(branches[0].id, 0);
- dungeon_lid = find_deepest_explored(dungeon_lid);
-
- snprintf(buffer, sizeof(buffer),
- "<yellow>%-7s</yellow> <darkgrey>(%d/%d)</darkgrey>",
- crawl_state.game_is_zotdef() ? "Zot" : "Dungeon",
- dungeon_lid.depth,
- brdepth[BRANCH_MAIN_DUNGEON]);
-
- disp += buffer;
- disp += std::string(std::max<int>(width - strlen(buffer), 0), ' ');
-
- for (int i = BRANCH_FIRST_NON_DUNGEON; i < NUM_BRANCHES; i++)
+ for (int i = 0; i < NUM_BRANCHES; i++)
{
const branch_type branch = branches[i].id;
- if (stair_level.find(branch) != stair_level.end())
+ if (branch == root_branch
+ || stair_level.find(branch) != stair_level.end())
{
level_id lid(branch, 0);
lid = find_deepest_explored(lid);
@@ -384,12 +373,15 @@ static std::string _get_seen_branches(bool display)
entry_desc += " " + it->describe(false, true);
}
+ // "D" is a little too short here.
+ const char *brname = (branch == BRANCH_MAIN_DUNGEON
+ ? branches[branch].shortname
+ : branches[branch].abbrevname);
+
snprintf(buffer, sizeof buffer,
- "<yellow>%7s</yellow> <darkgrey>(%d/%d)</darkgrey>%s",
- branches[branch].abbrevname,
- lid.depth,
- brdepth[branch],
- entry_desc.c_str());
+ "<yellow>%*s</yellow> <darkgrey>(%d/%d)</darkgrey>%s",
+ branch == root_branch ? -7 : 7,
+ brname, lid.depth, brdepth[branch], entry_desc.c_str());
disp += buffer;
num_printed_branches++;