* zilpin: Find the first tile entry which matches the given search criteria. * All parameters are optional. * To omit, specify NONE for that type * For tile directions, pass nullptr to omit. * @return matching index in tileTypeTable, or 0 if none found. */
| 309 | * @return matching index in tileTypeTable, or 0 if none found. |
| 310 | */ |
| 311 | inline |
| 312 | df::tiletype findTileType(const df::tiletype_shape tshape, const df::tiletype_material tmat, const df::tiletype_variant tvar, const df::tiletype_special tspecial, const TileDirection tdir) |
| 313 | { |
| 314 | FOR_ENUM_ITEMS(tiletype, tt) |
| 315 | { |
| 316 | if (tshape != tiletype_shape::NONE && tshape != tileShape(tt)) |
| 317 | continue; |
| 318 | if (tmat != tiletype_material::NONE && tmat != tileMaterial(tt)) |
| 319 | continue; |
| 320 | // Don't require variant to match if the destination tile doesn't even have one |
| 321 | if (tvar != tiletype_variant::NONE && tvar != tileVariant(tt) && tileVariant(tt) != tiletype_variant::NONE) |
| 322 | continue; |
| 323 | // Same for special |
| 324 | if (tspecial != tiletype_special::NONE && tspecial != tileSpecial(tt) && tileSpecial(tt) != tiletype_special::NONE) |
| 325 | continue; |
| 326 | if (tdir && tdir != tileDirection(tt)) |
| 327 | continue; |
| 328 | // Match! |
| 329 | return tt; |
| 330 | } |
| 331 | return tiletype::Void; |
| 332 | } |
| 333 | |
| 334 | /** |
| 335 | * zilpin: Find a tile type similar to the one given, but with a different class. |
no outgoing calls
no test coverage detected