1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Switch turn timers handling to boost asio timer

This commit is contained in:
Ivan Savenko
2023-12-26 20:54:32 +02:00
parent 0196707083
commit aa7ecea683
7 changed files with 43 additions and 20 deletions

View File

@ -80,4 +80,14 @@ void NetworkServer::onPacketReceived(const std::shared_ptr<NetworkConnection> &
listener.onPacketReceived(connection, message);
}
void NetworkServer::setTimer(std::chrono::milliseconds duration)
{
auto timer = std::make_shared<NetworkTimer>(*io, duration);
timer->async_wait([this, timer](const boost::system::error_code& error){
if (!error)
listener.onTimer();
});
}
VCMI_LIB_NAMESPACE_END