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

Method forEachTileAt

source/game/StarDungeonImagePart.cpp:50–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 }
49
50 void ImagePartReader::forEachTileAt(Vec2I pos, TileCallback const& callback) const {
51 for (auto const& entry : m_images) {
52 String const& file = entry.first;
53 ImageConstPtr const& image = entry.second;
54 Vec4B tileColor = image->get(pos.x(), pos.y());
55
56 if (auto const& tile = m_tileset->getTile(tileColor)) {
57 bool exitEarly = callback(pos, *tile);
58 if (exitEarly)
59 return;
60 } else {
61 throw StarException::format("Dungeon image {} uses unknown tile color: #{:02x}{:02x}{:02x}{:02x}",
62 file,
63 tileColor[0],
64 tileColor[1],
65 tileColor[2],
66 tileColor[3]);
67 }
68 }
69 }
70
71 String connectorColorValue(Vec4B const& color) {
72 return strf("{},{},{},{}", color[0], color[1], color[2], color[3]);

Callers

nothing calls this directly

Calls 5

xMethod · 0.80
yMethod · 0.80
formatFunction · 0.50
getMethod · 0.45
getTileMethod · 0.45

Tested by

no test coverage detected