MCPcopy Create free account
hub / github.com/DFHack/dfhack / findTileType

Function findTileType

library/include/TileTypes.h:311–332  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

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.

Callers 7

paintTileProcessingFunction · 0.85
regrass_tileFunction · 0.85
get_target_typeFunction · 0.85
adjust_smooth_wall_dirFunction · 0.85
smooth_tileFunction · 0.85
carve_tileFunction · 0.85
setTileMaterialFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected