2019-10-31 11:02:23 +00:00
|
|
|
#ifndef CREATURELIB_CHOICEQUEUE_HPP
|
|
|
|
#define CREATURELIB_CHOICEQUEUE_HPP
|
|
|
|
|
|
|
|
#include "../TurnChoices/BaseTurnChoice.hpp"
|
|
|
|
|
2019-11-28 11:55:22 +00:00
|
|
|
namespace CreatureLib::Battling {
|
2019-10-31 11:02:23 +00:00
|
|
|
class ChoiceQueue {
|
2020-06-02 11:06:24 +00:00
|
|
|
std::vector<std::shared_ptr<BaseTurnChoice>> _queue;
|
2019-10-31 11:02:23 +00:00
|
|
|
size_t _current = 0;
|
2019-11-28 11:55:22 +00:00
|
|
|
|
2019-10-31 11:02:23 +00:00
|
|
|
public:
|
2019-11-06 17:04:00 +00:00
|
|
|
bool HasCompletedQueue = false;
|
|
|
|
|
2020-06-02 11:06:24 +00:00
|
|
|
explicit ChoiceQueue(std::vector<std::shared_ptr<BaseTurnChoice>> queue) : _queue(std::move(queue)) {}
|
2019-10-31 11:02:23 +00:00
|
|
|
|
2020-06-02 11:06:24 +00:00
|
|
|
const std::shared_ptr<BaseTurnChoice>& Dequeue() { return _queue[_current++]; }
|
2019-10-31 11:02:23 +00:00
|
|
|
|
2020-06-02 11:06:24 +00:00
|
|
|
const std::shared_ptr<BaseTurnChoice>& Peek() { return _queue[_current]; }
|
2020-02-22 13:16:38 +00:00
|
|
|
|
2020-06-02 11:06:24 +00:00
|
|
|
[[nodiscard]] bool HasNext() const { return _current < _queue.size(); }
|
2019-11-10 13:32:05 +00:00
|
|
|
|
2020-06-02 11:06:24 +00:00
|
|
|
const std::vector<std::shared_ptr<BaseTurnChoice>>& GetInnerQueue() { return _queue; }
|
2020-02-22 13:16:38 +00:00
|
|
|
|
2022-03-23 17:30:35 +00:00
|
|
|
bool MoveCreatureChoiceNext(Creature* non_null creature);
|
2019-10-31 11:02:23 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-11-28 11:55:22 +00:00
|
|
|
#endif // CREATURELIB_CHOICEQUEUE_HPP
|