| 957 | } |
| 958 | |
| 959 | staticfn void |
| 960 | init_dungeon_set_depth(struct proto_dungeon *pd, int dngidx) |
| 961 | { |
| 962 | branch *br; |
| 963 | schar from_depth; |
| 964 | boolean from_up; |
| 965 | |
| 966 | br = add_branch(dngidx, svd.dungeons[dngidx].entry_lev, pd); |
| 967 | |
| 968 | /* Get the depth of the connecting end. */ |
| 969 | if (br->end1.dnum == dngidx) { |
| 970 | from_depth = depth(&br->end2); |
| 971 | from_up = !br->end1_up; |
| 972 | } else { |
| 973 | from_depth = depth(&br->end1); |
| 974 | from_up = br->end1_up; |
| 975 | } |
| 976 | |
| 977 | /* |
| 978 | * Calculate the depth of the top of the dungeon via |
| 979 | * its branch. First, the depth of the entry point: |
| 980 | * |
| 981 | * depth of branch from "parent" dungeon |
| 982 | * + -1 or 1 depending on an up or down stair or |
| 983 | * 0 if portal |
| 984 | * |
| 985 | * Followed by the depth of the top of the dungeon: |
| 986 | * |
| 987 | * - (entry depth - 1) |
| 988 | * |
| 989 | * We'll say that portals stay on the same depth. |
| 990 | */ |
| 991 | svd.dungeons[dngidx].depth_start = |
| 992 | from_depth + (br->type == BR_PORTAL ? 0 : (from_up ? -1 : 1)) |
| 993 | - (svd.dungeons[dngidx].entry_lev - 1); |
| 994 | } |
| 995 | |
| 996 | staticfn boolean |
| 997 | init_dungeon_dungeons( |
no test coverage detected