{
delay = 0;
}
+ auto countdownBase = static_cast<unsigned int>(delay * 10);
- auto it = mCoalescableMessages.insert({{kind, obj}, {static_cast<unsigned int>(delay * 10), {}}});
+ auto it = mCoalescableMessages.insert({{kind, obj}, {countdownBase, countdownBase, {}}});
if(it.second)
{
functor();
}
else
{
- it.first->second.second = std::move(functor);
+ std::get<1>(it.first->second) = countdownBase;
+ std::get<2>(it.first->second) = std::move(functor);
}
if(!tickTimer)
{
for(auto it = mCoalescableMessages.begin(); it != mCoalescableMessages.end();)
{
- if(it->second.first)
+ auto& countdown = std::get<0>(it->second);
+ auto countdownBase = std::get<1>(it->second);
+ auto& functor = std::get<2>(it->second);
+ if(countdown)
{
- --it->second.first;
+ --countdown;
}
else
{
- if(it->second.second)
+ if(functor)
{
- it->second.second();
- it->second.second = {};
+ functor();
+ functor = {};
+ countdown = countdownBase;
}
else
{