This commit is contained in:
2025-03-11 19:37:36 +06:00
parent e190c79d00
commit 1710eb974d
10 changed files with 178 additions and 64 deletions

View File

@@ -247,7 +247,7 @@ coro<> GameServer::pushSocketGameProtocol(tcp::socket socket, const std::string
co_await Net::AsyncSocket::write<uint8_t>(socket, 0);
External.NewConnectedPlayers.lock_write()
->push_back(std::make_unique<RemoteClient>(IOC, std::move(socket), username));
->push_back(RemoteClient::Create(IOC, std::move(socket), username));
}
}
}
@@ -333,7 +333,7 @@ void GameServer::run() {
// Отключить вновь подключившихся
auto lock = External.NewConnectedPlayers.lock_write();
for(std::unique_ptr<RemoteClient> &client : *lock) {
for(RemoteClient_ptr &client : *lock) {
client->shutdown(EnumDisconnect::ByInterface, ShutdownReason);
}
@@ -449,8 +449,7 @@ void GameServer::stepPlayers() {
if(!External.NewConnectedPlayers.no_lock_readable().empty()) {
auto lock = External.NewConnectedPlayers.lock_write();
for(std::unique_ptr<RemoteClient> &client : *lock) {
asio::co_spawn(IOC, client->run(), asio::detached);
for(RemoteClient_ptr &client : *lock) {
Game.CECs.push_back(std::make_unique<ContentEventController>(std::move(client)));
}