MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / CheckRadiusTileID

Method CheckRadiusTileID

Source/Map/Random.cpp:65–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65bool cRandomMap::CheckRadiusTileID(std::vector<size_t> pTileIDs, cPosition* pPosition, int32 pRadius) {
66 for (int32 x = pPosition->mX - pRadius; x < pPosition->mX + pRadius; x++) {
67 if (x < 0)
68 continue;
69
70 int32 yspan = (int32)(pRadius * sin(acos((pPosition->mX - x) / pRadius)));
71 for (int32 y = pPosition->mY - yspan; y < pPosition->mY + yspan; y++) {
72 if (y < 0)
73 continue;
74
75 int32 TileID = Tile_Get(x, y);
76 if (std::find(pTileIDs.begin(), pTileIDs.end(), TileID) == pTileIDs.end())
77 return false;
78 }
79 }
80
81 return true;
82}
83
84bool cRandomMap::CheckRadiusFeatures(const std::vector<eTerrainFeature> &pTypes, cPosition* pPosition, int32 pRadius) {
85 for (int32 x = pPosition->mX - pRadius; x < pPosition->mX + pRadius; x++) {

Callers

nothing calls this directly

Calls 3

findFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected