MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / matchTile

Function matchTile

source/utility/map_grep.cpp:22–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20String const MapFilenameSuffix = ".json";
21
22Maybe<String> matchTile(SearchParameters const& search, Tiled::Tile const& tile) {
23 Tiled::Properties const& properties = tile.properties;
24 if (search.criteria.is<TileName>()) {
25 if (auto tileName = properties.opt<String>("//name"))
26 if (tileName->regexMatch(search.criteria.get<TileName>()))
27 return tileName;
28 } else {
29 String propertyName;
30 String matchValue;
31 tie(propertyName, matchValue) = search.criteria.get<TileProperty>();
32 if (auto propertyValue = properties.opt<String>(propertyName))
33 if (propertyValue->regexMatch(matchValue))
34 return properties.opt<String>("//name").value("?");
35 }
36 return {};
37}
38
39void grepTileLayer(SearchParameters const& search, TMXMapPtr map, TMXTileLayerPtr tileLayer, MatchReporter callback) {
40 tileLayer->forEachTile(map.get(),

Callers 2

grepTileLayerFunction · 0.85
grepObjectGroupFunction · 0.85

Calls 2

regexMatchMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected