| 2020 | // tile_spec |
| 2021 | |
| 2022 | string tile_spec::get_tile() |
| 2023 | { |
| 2024 | if (chose_fixed) |
| 2025 | return fixed_tile; |
| 2026 | |
| 2027 | string chosen = ""; |
| 2028 | int cweight = 0; |
| 2029 | for (const map_weighted_tile &tile : tiles) |
| 2030 | if (x_chance_in_y(tile.second, cweight += tile.second)) |
| 2031 | chosen = tile.first; |
| 2032 | |
| 2033 | if (fix) |
| 2034 | { |
| 2035 | chose_fixed = true; |
| 2036 | fixed_tile = chosen; |
| 2037 | } |
| 2038 | return chosen; |
| 2039 | } |
| 2040 | |
| 2041 | ////////////////////////////////////////////////////////////////////////// |
| 2042 | // map_lines::iterator |
no test coverage detected