Another rework for scripthooks, for better performance.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This new version caches pointers to the pointers to scripts, so that we can build the data once and then simply iterate over it whenever we want to run a hook.
This commit is contained in:
@@ -7,12 +7,12 @@
|
||||
|
||||
namespace CreatureLib::Battling{
|
||||
class ChoiceQueue {
|
||||
std::vector<const BaseTurnChoice*> _queue;
|
||||
std::vector<BaseTurnChoice*> _queue;
|
||||
size_t _current = 0;
|
||||
public:
|
||||
bool HasCompletedQueue = false;
|
||||
|
||||
explicit ChoiceQueue(std::vector<const BaseTurnChoice*> queue)
|
||||
explicit ChoiceQueue(std::vector<BaseTurnChoice*> queue)
|
||||
:_queue(std::move(queue)){}
|
||||
|
||||
const BaseTurnChoice* Dequeue(){
|
||||
@@ -25,7 +25,7 @@ namespace CreatureLib::Battling{
|
||||
return _current < _queue.size();
|
||||
}
|
||||
|
||||
std::vector<const BaseTurnChoice*>& GetInnerQueue(){
|
||||
std::vector<BaseTurnChoice*>& GetInnerQueue(){
|
||||
return _queue;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user