diff options
author | Adam Borowski <kilobyte@angband.pl> | 2011-10-26 16:44:21 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2011-11-04 18:49:50 +0100 |
commit | acbc1dae1491c9d986fd81acb70a91ba8785bf4d (patch) | |
tree | 7c05c37668f14a4c3bb624fa7c6b511dbbcab1c0 /crawl-ref/source/branch.cc | |
parent | ff3b896cb6e3770cd593b867405fde9a94bba00b (diff) | |
download | crawl-ref-acbc1dae1491c9d986fd81acb70a91ba8785bf4d.tar.gz crawl-ref-acbc1dae1491c9d986fd81acb70a91ba8785bf4d.zip |
Split the branch data into read-only and mutable parts.
As a side effect, branches can now be shortened without breaking major save
compat.
This commit itself doesn't preserve compat though, even though it'd be easy
-- other parts are too nasty already.
Diffstat (limited to 'crawl-ref/source/branch.cc')
-rw-r--r-- | crawl-ref/source/branch.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crawl-ref/source/branch.cc b/crawl-ref/source/branch.cc index 3ef88405bf..b1a9d7f0ee 100644 --- a/crawl-ref/source/branch.cc +++ b/crawl-ref/source/branch.cc @@ -10,14 +10,16 @@ #include "travel.h" #include "branch-data.h" -Branch& your_branch() +FixedVector<int, NUM_BRANCHES> startdepth, brdepth; + +const Branch& your_branch() { return branches[you.where_are_you]; } bool at_branch_bottom() { - return your_branch().depth == player_branch_depth(); + return brdepth[you.where_are_you] == player_branch_depth(); } level_id branch_entry_level(branch_type branch) @@ -34,7 +36,7 @@ level_id branch_entry_level(branch_type branch) } const branch_type parent = branches[branch].parent_branch; - const int subdepth = branches[branch].startdepth; + const int subdepth = startdepth[branch]; // This may be invalid if the branch doesn't exist this game -- // it's the caller's job to check. |