Fix iterators

This commit is contained in:
momo5502 2019-01-26 12:51:23 +01:00
parent 70a7467105
commit e1aa7c19ef
4 changed files with 11 additions and 10 deletions

View File

@ -32,7 +32,7 @@ namespace game
{
std::vector<chaiscript::Boxed_Value> arguments;
for (const auto& argument : event->arguments)
for (auto argument : event->arguments)
{
arguments.push_back(this->context_->get_parameters()->load(argument));
}
@ -49,7 +49,7 @@ namespace game
void event_handler::dispatch_to_specific_listeners(event* event,
const std::vector<chaiscript::Boxed_Value>& arguments)
{
for (const auto& listener : this->event_listeners_)
for (auto listener : this->event_listeners_)
{
if (listener->event == event->name && listener->entity_id == event->entity_id)
{
@ -66,7 +66,7 @@ namespace game
void event_handler::dispatch_to_generic_listeners(event* event,
const std::vector<chaiscript::Boxed_Value>& arguments)
{
for (const auto& listener : this->generic_event_listeners_)
for (auto listener : this->generic_event_listeners_)
{
if (listener->event == event->name)
{
@ -96,7 +96,7 @@ namespace game
void event_handler::remove(const event_listener_handle& handle)
{
for (const auto& task : this->event_listeners_)
for (auto task : this->event_listeners_)
{
if (task->id == handle.id)
{
@ -105,7 +105,7 @@ namespace game
}
}
for (const auto& task : this->generic_event_listeners_)
for (auto task : this->generic_event_listeners_)
{
if (task->id == handle.id)
{

View File

@ -100,7 +100,7 @@ namespace game
stack_isolation _;
std::reverse(arguments.begin(), arguments.end());
for (const auto& argument : arguments)
for (auto argument : arguments)
{
this->context_->get_parameters()->push(argument);
}

View File

@ -40,7 +40,7 @@ namespace game
void scheduler::run_frame()
{
for (const auto& task : this->tasks_)
for (auto task : this->tasks_)
{
const auto now = std::chrono::steady_clock::now();
if ((now - task->last_execution) > task->delay)
@ -79,7 +79,7 @@ namespace game
void scheduler::remove(const task_handle& handle)
{
for (const auto& task : this->tasks_)
for (auto task : this->tasks_)
{
if(task->id == handle.id)
{

View File

@ -39,13 +39,14 @@ __declspec(naked) void scheduler::execute()
void scheduler::execute_safe()
{
for (const auto& callback : callbacks_)
for (auto callback : callbacks_)
{
(*callback)();
}
for (const auto& callback : single_callbacks_)
for (auto callback : single_callbacks_)
{
single_callbacks_.remove(callback);
(*callback)();
}
}