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

Function _pick_dngn_tile_multi

crawl-ref/source/tileview.cc:469–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

467}
468
469static tileidx_t _pick_dngn_tile_multi(
470 const vector<pair<tileidx_t, int>>& candidates,
471 int rand)
472{
473 int total = 0;
474 for (const pair<tileidx_t, int>& candidate : candidates)
475 total += candidate.second;
476
477 int rand1 = rand % total;
478 int rand2 = rand / total;
479
480 for (const pair<tileidx_t, int>& candidate : candidates)
481 {
482 if (rand1 < candidate.second)
483 {
484 // XXX: this should be for any animated tile
485 if (is_torch_tile(candidate.first))
486 return candidate.first;
487 return pick_dngn_tile(candidate.first, rand2, -1);
488 }
489 rand1 -= candidate.second;
490 }
491
492 // Should never reach this place
493 die("couldn't find tile");
494}
495
496static bool _same_door_at(dungeon_feature_type feat, const coord_def &gc)
497{

Callers 1

tile_init_flavourFunction · 0.85

Calls 3

is_torch_tileFunction · 0.85
pick_dngn_tileFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected