Initial support for ordering choices and getting them ready for execution.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
28
src/Battling/Flow/ChoiceQueue.hpp
Normal file
28
src/Battling/Flow/ChoiceQueue.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef CREATURELIB_CHOICEQUEUE_HPP
|
||||
#define CREATURELIB_CHOICEQUEUE_HPP
|
||||
|
||||
#include <vector>
|
||||
#include "../TurnChoices/BaseTurnChoice.hpp"
|
||||
|
||||
namespace CreatureLib::Battling{
|
||||
class ChoiceQueue {
|
||||
std::vector<const BaseTurnChoice*> _queue;
|
||||
size_t _current = 0;
|
||||
public:
|
||||
ChoiceQueue(const std::vector<const BaseTurnChoice*>& queue)
|
||||
:_queue(queue){}
|
||||
|
||||
const BaseTurnChoice* Dequeue(){
|
||||
auto b = _queue[_current];
|
||||
_current++;
|
||||
return b;
|
||||
}
|
||||
|
||||
bool HasNext() const{
|
||||
return _current < _queue.size();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //CREATURELIB_CHOICEQUEUE_HPP
|
||||
Reference in New Issue
Block a user