CreatureLib/src/Battling/Flow/ChoiceQueue.hpp

29 lines
897 B
C++

#ifndef CREATURELIB_CHOICEQUEUE_HPP
#define CREATURELIB_CHOICEQUEUE_HPP
#include "../TurnChoices/BaseTurnChoice.hpp"
namespace CreatureLib::Battling {
class ChoiceQueue {
std::vector<std::shared_ptr<BaseTurnChoice>> _queue;
size_t _current = 0;
public:
bool HasCompletedQueue = false;
explicit ChoiceQueue(std::vector<std::shared_ptr<BaseTurnChoice>> queue) : _queue(std::move(queue)) {}
const std::shared_ptr<BaseTurnChoice>& Dequeue() { return _queue[_current++]; }
const std::shared_ptr<BaseTurnChoice>& Peek() { return _queue[_current]; }
[[nodiscard]] bool HasNext() const { return _current < _queue.size(); }
const std::vector<std::shared_ptr<BaseTurnChoice>>& GetInnerQueue() { return _queue; }
bool MoveCreatureChoiceNext(Creature* non_null creature);
};
}
#endif // CREATURELIB_CHOICEQUEUE_HPP