CreatureLib/src/Battling/Flow/ChoiceQueue.hpp

35 lines
891 B
C++
Raw Normal View History

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