Support turn queue return prematurely when a creature is recalled, and the ability to resume it later.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef CREATURELIB_CHOICEQUEUE_HPP
|
||||
#define CREATURELIB_CHOICEQUEUE_HPP
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include "../TurnChoices/BaseTurnChoice.hpp"
|
||||
|
||||
@@ -9,8 +10,10 @@ namespace CreatureLib::Battling{
|
||||
std::vector<const BaseTurnChoice*> _queue;
|
||||
size_t _current = 0;
|
||||
public:
|
||||
ChoiceQueue(const std::vector<const BaseTurnChoice*>& queue)
|
||||
:_queue(queue){}
|
||||
bool HasCompletedQueue = false;
|
||||
|
||||
explicit ChoiceQueue(std::vector<const BaseTurnChoice*> queue)
|
||||
:_queue(std::move(queue)){}
|
||||
|
||||
const BaseTurnChoice* Dequeue(){
|
||||
auto b = _queue[_current];
|
||||
@@ -18,7 +21,7 @@ namespace CreatureLib::Battling{
|
||||
return b;
|
||||
}
|
||||
|
||||
bool HasNext() const{
|
||||
[[nodiscard]] bool HasNext() const{
|
||||
return _current < _queue.size();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user