mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 05:36:23 +00:00
refactor(Core/Misc): add braces and impove codestyle (#6402)
This commit is contained in:
@@ -65,7 +65,9 @@ void TaskScheduler::Dispatch(success_t const& callback)
|
||||
{
|
||||
// If the validation failed abort the dispatching here.
|
||||
if (!_predicate())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Process all asyncs
|
||||
while (!_asyncHolder.empty())
|
||||
@@ -75,13 +77,17 @@ void TaskScheduler::Dispatch(success_t const& callback)
|
||||
|
||||
// If the validation failed abort the dispatching here.
|
||||
if (!_predicate())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
while (!_task_holder.IsEmpty())
|
||||
{
|
||||
if (_task_holder.First()->_end > _now)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Perfect forward the context to the handler
|
||||
// Use weak references to catch destruction before callbacks.
|
||||
@@ -92,7 +98,9 @@ void TaskScheduler::Dispatch(success_t const& callback)
|
||||
|
||||
// If the validation failed abort the dispatching here.
|
||||
if (!_predicate())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// On finish call the final callback
|
||||
@@ -125,9 +133,13 @@ void TaskScheduler::TaskQueue::RemoveIf(std::function<bool(TaskContainer const&)
|
||||
{
|
||||
for (auto itr = container.begin(); itr != container.end();)
|
||||
if (filter(*itr))
|
||||
{
|
||||
itr = container.erase(itr);
|
||||
}
|
||||
else
|
||||
{
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
void TaskScheduler::TaskQueue::ModifyIf(std::function<bool(TaskContainer const&)> const& filter)
|
||||
@@ -140,7 +152,9 @@ void TaskScheduler::TaskQueue::ModifyIf(std::function<bool(TaskContainer const&)
|
||||
itr = container.erase(itr);
|
||||
}
|
||||
else
|
||||
{
|
||||
++itr;
|
||||
}
|
||||
|
||||
container.insert(cache.begin(), cache.end());
|
||||
}
|
||||
@@ -153,7 +167,9 @@ bool TaskScheduler::TaskQueue::IsEmpty() const
|
||||
TaskContext& TaskContext::Dispatch(std::function<TaskScheduler&(TaskScheduler&)> const& apply)
|
||||
{
|
||||
if (auto const owner = _owner.lock())
|
||||
{
|
||||
apply(*owner);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user