| 365 | return sourceTileType; |
| 366 | } |
| 367 | df::tiletype findRandomVariant (const df::tiletype tile) |
| 368 | { |
| 369 | if (tileVariant(tile) == tiletype_variant::NONE) |
| 370 | return tile; |
| 371 | std::vector<df::tiletype> matches; |
| 372 | FOR_ENUM_ITEMS(tiletype, tt) |
| 373 | { |
| 374 | if (tileShape(tt) == tileShape(tile) && |
| 375 | tileMaterial(tt) == tileMaterial(tile) && |
| 376 | tileSpecial(tt) == tileSpecial(tile)) |
| 377 | matches.push_back(tt); |
| 378 | } |
| 379 | return matches[rand() % matches.size()]; |
| 380 | } |
| 381 | } |
no test coverage detected