38 lines
792 B
C++
38 lines
792 B
C++
|
#include "hole_layout.hpp"
|
||
|
#include "../../../player/player_collection.hpp"
|
||
|
|
||
|
std::shared_ptr<HoleLayout> HoleLayout::getInstance()
|
||
|
{
|
||
|
if (singletonInstance == nullptr)
|
||
|
{
|
||
|
singletonInstance = std::make_shared<HoleLayout>();
|
||
|
}
|
||
|
return singletonInstance;
|
||
|
}
|
||
|
|
||
|
void HoleLayout::clear()
|
||
|
{
|
||
|
previousHoles.clear();
|
||
|
currentHoles.clear();
|
||
|
}
|
||
|
|
||
|
void HoleLayout::lateUpdate()
|
||
|
{
|
||
|
// Move history forward
|
||
|
previousHoles = currentHoles;
|
||
|
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(), previousHoles()
|
||
|
{}
|