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

Method GetPos

src/openrct2/interface/Viewport.cpp:114–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112 }
113
114 CoordsXYZ Focus::GetPos() const
115 {
116 return std::visit(
117 [](auto&& arg) {
118 using T = std::decay_t<decltype(arg)>;
119 if constexpr (std::is_same_v<T, CoordinateFocus>)
120 return arg;
121 else if constexpr (std::is_same_v<T, EntityFocus>)
122 {
123 auto* centreEntity = getGameState().entities.GetEntity(arg);
124 if (centreEntity != nullptr)
125 {
126 return CoordsXYZ{ centreEntity->x, centreEntity->y, centreEntity->z };
127 }
128 else
129 {
130 LOG_ERROR("Invalid entity for focus.");
131 return CoordsXYZ{};
132 }
133 }
134 },
135 data);
136 }
137
138 /**
139 * Viewport will look at sprite or at coordinates as specified in flags 0b_1X

Callers 2

ViewportCreateFunction · 0.80
scrollToViewportMethod · 0.80

Calls 1

GetEntityMethod · 0.45

Tested by

no test coverage detected