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

Function pick_dngn_tile

crawl-ref/source/tileview.cc:448–467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446}
447
448tileidx_t pick_dngn_tile(tileidx_t idx, int value, int domino)
449{
450 ASSERT_LESS(idx, TILE_DNGN_MAX);
451 static vector<int> weights;
452 weights.clear();
453
454 int total = _find_variants(idx, domino, weights);
455 if (weights.size() == 1)
456 return idx;
457 int rand = value % total;
458
459 for (size_t i = 0; i < weights.size(); ++i)
460 {
461 rand -= weights[i];
462 if (rand < 0)
463 return idx + i;
464 }
465
466 return idx;
467}
468
469static tileidx_t _pick_dngn_tile_multi(
470 const vector<pair<tileidx_t, int>>& candidates,

Callers 4

_pick_dngn_tile_multiFunction · 0.85
tile_init_flavourFunction · 0.85
GodMenuEntryMethod · 0.85
apply_variationsFunction · 0.85

Calls 3

_find_variantsFunction · 0.85
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected