mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Move Baking Status
This commit is contained in:
parent
fd3156b57c
commit
859ec57ded
2 changed files with 25 additions and 12 deletions
|
@ -10,23 +10,26 @@
|
|||
//
|
||||
|
||||
#include "AutoBaker.h"
|
||||
#include <shared/Algorithms.h>
|
||||
|
||||
using namespace alg;
|
||||
|
||||
void AutoBaker::addPendingBake(AssetHash hash) {
|
||||
_pendingBakes.push_back(hash);
|
||||
|
||||
// Maybe start baking it right away
|
||||
}
|
||||
|
||||
bool AutoBaker::assetNeedsBaking(AssetHash hash) {
|
||||
return true;
|
||||
}
|
||||
|
||||
AutoBaker::Status AutoBaker::getAssetStatus(AssetHash hash) {
|
||||
auto pendingIt = std::find(_pendingBakes.cbegin(), _pendingBakes.cend(), hash);
|
||||
if (pendingIt != _pendingBakes.cend()) {
|
||||
BakingStatus AutoBaker::getAssetStatus(AssetHash hash) {
|
||||
if (find(_pendingBakes, hash) != std::end(_pendingBakes)) {
|
||||
return Pending;
|
||||
}
|
||||
|
||||
auto bakingIt = std::find(_currentlyBaking.cbegin(), _currentlyBaking.cend(), hash);
|
||||
if (bakingIt != _currentlyBaking.cend()) {
|
||||
if (find(_currentlyBaking, hash) != std::end(_currentlyBaking)) {
|
||||
return Baking;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,20 +9,30 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef Algorithms_h
|
||||
#define Algorithms_h
|
||||
#ifndef hifi_Algorithms_h
|
||||
#define hifi_Algorithms_h
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
namespace alg {
|
||||
|
||||
template <class Container, class ValueType>
|
||||
auto find(const Container& container, const ValueType& value) -> decltype(std::begin(container)) {
|
||||
return std::find(std::begin(container), std::end(container), value);
|
||||
}
|
||||
|
||||
template <class Container, class Predicate>
|
||||
auto find_if(const Container& container, Predicate&& predicate) -> decltype(std::begin(container)) {
|
||||
return std::find_if(std::begin(container), std::end(container), std::forward<Predicate>(predicate));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <class Container, class Predicate>
|
||||
auto find_if_not(const Container& container, Predicate&& predicate) -> decltype(std::begin(container)) {
|
||||
return std::find_if_not(std::begin(container), std::end(container), std::forward<Predicate>(predicate));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif /* Algorithms_hpp */
|
||||
#endif // hifi_Algorithms_hpp
|
||||
|
|
Loading…
Reference in a new issue