| 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 |
no test coverage detected