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

Method CheckRadiusFeatures

Source/Map/Random.cpp:84–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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++) {
86 if (x < 0)
87 continue;
88
89 int32 yspan = (int32) (pRadius * sin(acos((pPosition->mX - x) / pRadius)));
90 for (int32 y = pPosition->mY - yspan; y < pPosition->mY + yspan; y++) {
91 if (y < 0)
92 continue;
93
94 int32 Terrain = g_Fodder->Map_Terrain_Get(x, y);
95 if (std::find(pTypes.begin(), pTypes.end(), Terrain) == pTypes.end())
96 return false;
97 }
98 }
99
100 return true;
101}
102
103bool cRandomMap::CheckRadiusSprites(cPosition* pPosition, int32 pRadius) {
104

Callers

nothing calls this directly

Calls 4

findFunction · 0.85
Map_Terrain_GetMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected