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

Function getSideFromPos

src/OpenLoco/src/Map/MapSelection.cpp:256–268  ·  view source on GitHub ↗

0x0045FE4C 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

254 // instead OpenLoco has split it in two. Also note that result of original
255 // was a Pos2 start i.e. (& 0xFFE0) both components
256 MapSelectionType getSideFromPos(const Pos2& loc)
257 {
258 const auto xNibble = loc.x & 0x1F;
259 const auto yNibble = loc.y & 0x1F;
260 if (xNibble < yNibble)
261 {
262 return (xNibble + yNibble < 32) ? MapSelectionType::corner0 : MapSelectionType::corner1;
263 }
264 else
265 {
266 return (xNibble + yNibble < 32) ? MapSelectionType::corner3 : MapSelectionType::corner2;
267 }
268 }
269
270 MapSelectionFlags getMapSelectionFlags()
271 {

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected