MCPcopy Create free account
hub / github.com/crawl/crawl / _write_vault

Function _write_vault

crawl-ref/source/maps.cc:119–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119static map_section_type _write_vault(map_def &mdef,
120 vault_placement &place,
121 bool check_place)
122{
123 mdef.load();
124
125 // Copy the map so we can monkey with it.
126 place.map = mdef;
127 place.map.original = &mdef;
128
129 // Try so many times to place the map. This will always succeed
130 // unless there are conflicting map placements in 'avoid', or there
131 // is a map validate Lua hook that keeps rejecting the map.
132 int tries = 25;
133
134 while (tries-- > 0)
135 {
136 // We're a regular vault, so clear the subvault stack.
137 clear_subvault_stack();
138
139 if (place.map.test_lua_veto())
140 break;
141
142 if (!_resolve_map(place.map))
143 {
144 // for most fatal errors, there's no point in trying again. (This
145 // isn't 100% true, e.g. an error in an itemspec that's hidden
146 // behind a random roll may fix itself. But it's true enough that
147 // it's better on average to consider this map bugged and move
148 // on to another one in normal generation.)
149 if (crawl_state.last_builder_error_fatal)
150 break;
151 else
152 continue;
153 }
154
155 // Must set size here, or minivaults will not be placed correctly.
156 place.size = place.map.size();
157 place.orient = _apply_vault_definition(place.map,
158 place, check_place);
159
160 if (place.orient != MAP_NONE)
161 return place.orient;
162 }
163 return MAP_NONE;
164}
165
166static void _dgn_flush_map_environments()
167{

Callers 1

vault_mainFunction · 0.85

Calls 6

clear_subvault_stackFunction · 0.85
_resolve_mapFunction · 0.85
_apply_vault_definitionFunction · 0.85
test_lua_vetoMethod · 0.80
loadMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected