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

Function findRandomVariant

library/TileTypes.cpp:367–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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}

Callers 6

findSimilarTileTypeFunction · 0.85
df_liquids_executeFunction · 0.85
tubefillFunction · 0.85
regrass_tileFunction · 0.85
get_target_typeFunction · 0.85
set_ttFunction · 0.85

Calls 2

tileVariantFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected