MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / getQuadrantFromPos

Function getQuadrantFromPos

src/OpenLoco/src/Map/MapSelection.cpp:238–250  ·  view source on GitHub ↗

0x0045FE05 NOTE: Original call getSurfaceLocFromUi within this function instead OpenLoco has split it in two. Also note that result of original was a Pos2 start i.e. (& 0xFFE0) both components

Source from the content-addressed store, hash-verified

236 // instead OpenLoco has split it in two. Also note that result of original
237 // was a Pos2 start i.e. (& 0xFFE0) both components
238 MapSelectionType getQuadrantFromPos(const Pos2& loc)
239 {
240 const auto xNibble = loc.x & 0x1F;
241 const auto yNibble = loc.y & 0x1F;
242 if (xNibble > 16)
243 {
244 return (yNibble >= 16) ? MapSelectionType::corner0 : MapSelectionType::corner1;
245 }
246 else
247 {
248 return (yNibble >= 16) ? MapSelectionType::corner3 : MapSelectionType::corner2;
249 }
250 }
251
252 // 0x0045FE4C
253 // NOTE: Original call getSurfaceLocFromUi within this function

Callers 3

placeRandomTreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected