MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / FootpathFixOwnership

Function FootpathFixOwnership

src/openrct2/world/Footpath.cpp:1035–1068  ·  view source on GitHub ↗

* * rct2: 0x0069ADBD */

Source from the content-addressed store, hash-verified

1033 * rct2: 0x0069ADBD
1034 */
1035 static void FootpathFixOwnership(const CoordsXY& mapPos)
1036 {
1037 const auto* surfaceElement = MapGetSurfaceElementAt(mapPos);
1038 uint16_t ownership;
1039
1040 // Unlikely to be NULL unless deliberate.
1041 if (surfaceElement != nullptr)
1042 {
1043 // If the tile is not safe to own construction rights of, erase them.
1044 if (CheckMaxAllowableLandRightsForTile({ mapPos, surfaceElement->baseHeight << 3 }) == OWNERSHIP_UNOWNED)
1045 {
1046 ownership = OWNERSHIP_UNOWNED;
1047 }
1048 // If the tile is safe to own construction rights of, do not erase construction rights.
1049 else
1050 {
1051 ownership = surfaceElement->GetOwnership();
1052 // You can't own the entrance path.
1053 if (ownership == OWNERSHIP_OWNED || ownership == OWNERSHIP_AVAILABLE)
1054 {
1055 ownership = OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED;
1056 }
1057 }
1058 }
1059 else
1060 {
1061 ownership = OWNERSHIP_UNOWNED;
1062 }
1063
1064 auto landSetRightsAction = GameActions::LandSetRightsAction(
1065 mapPos, GameActions::LandSetRightSetting::setOwnershipWithChecks, ownership);
1066 landSetRightsAction.SetFlags({ CommandFlag::noSpend });
1067 GameActions::Execute(&landSetRightsAction, getGameState());
1068 }
1069
1070 static bool GetNextDirection(uint32_t edges, int32_t* direction)
1071 {

Callers 1

Calls 6

MapGetSurfaceElementAtFunction · 0.85
LandSetRightsActionClass · 0.85
SetFlagsMethod · 0.80
ExecuteFunction · 0.50
GetOwnershipMethod · 0.45

Tested by

no test coverage detected