| 467 | } |
| 468 | |
| 469 | static 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 | |
| 496 | static bool _same_door_at(dungeon_feature_type feat, const coord_def &gc) |
| 497 | { |
no test coverage detected