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

Function getOneCornerUpLandHeight

src/OpenLoco/src/Map/TileManager.cpp:391–415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389 constexpr uint8_t kTileSize = 31;
390
391 static int16_t getOneCornerUpLandHeight(int8_t xl, int8_t yl, uint8_t slope)
392 {
393 int16_t quad = 0;
394 switch (slope)
395 {
396 case SurfaceSlope::CornerUp::north:
397 quad = xl + yl - kTileSize;
398 break;
399 case SurfaceSlope::CornerUp::east:
400 quad = xl - yl;
401 break;
402 case SurfaceSlope::CornerUp::south:
403 quad = kTileSize - yl - xl;
404 break;
405 case SurfaceSlope::CornerUp::west:
406 quad = yl - xl;
407 break;
408 }
409 // If the element is in the quadrant with the slope, raise its height
410 if (quad > 0)
411 {
412 return quad / 2;
413 }
414 return 0;
415 }
416
417 static int16_t getOneSideUpLandHeight(int8_t xl, int8_t yl, uint8_t slope)
418 {

Callers 1

getHeightFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected