#include "beatsetimpl.h" #include //debug print #include #include "beatlevelimpl.h" namespace Beatsaber { BeatSetImpl::BeatSetImpl(std::weak_ptr p, std::shared_ptr r, const json& j) : parent(p) { try { characteristic = BeatmapCharacteristic::getByString(j["_beatmapCharacteristicName"]); //load level const json& arr = j["_difficultyBeatmaps"]; if(arr.is_array()) { level.reserve(arr.size()); //std::cout << "Try to load: " << arr.size() << " BeatLevel" << std::endl; for(const json& beat : arr) { level.push_back(std::make_shared(weak_from_this(), r, beat)); } } } catch(std::exception& e) { std::cout << "Could not read BeatSet: " << e.what() << std::endl; characteristic = BeatmapCharacteristic::NONE; } } BeatSetImpl::~BeatSetImpl() {} void BeatSetImpl::printDebug() const { std::cout << " Characteristic: " << BeatmapCharacteristic::toString(characteristic) << std::endl; for(auto it : level) { it->printDebug(); } } BeatmapCharacteristic::BeatmapCharacteristic BeatSetImpl::getCharacteristic() const { return characteristic; } std::shared_ptr BeatSetImpl::getBeatMap() const { return parent.lock(); } }