#include "hole_layout.hpp" #include "../../../player/player_collection.hpp" std::shared_ptr HoleLayout::getInstance() { if (singletonInstance == nullptr) { singletonInstance = std::make_shared(); } return singletonInstance; } void HoleLayout::clear() { currentHoles.clear(); } void HoleLayout::lateUpdate() { currentHoles.clear(); // Collect hole descriptions of active players for (const auto &player: PlayerCollection::getInstance()->getPlayers()) { if (player->getActive()) { currentHoles.emplace_back(player); } } } HoleLayout::HoleLayout() : currentHoles() {} DepthHoleLayout HoleLayout::atDepth(float depth) const { std::vector depthHoles{}; for (const auto &hole: currentHoles) { auto holeAtDepth = hole.atDepth(depth); if (holeAtDepth.width <= 0) { continue; } depthHoles.push_back(holeAtDepth); } return {depth, depthHoles}; }