Implement autodeletion of players on logout

This commit is contained in:
2024-03-04 16:33:23 -05:00
parent c2a94b5332
commit 044bb89edf
4 changed files with 84 additions and 11 deletions

View File

@@ -43,7 +43,7 @@ public:
master_->update_source(srcpk);
// Create an actor for administrative commands.
admin_id_ = master_->create_login_actor(true);
admin_id_ = master_->create_login_actor();
// TODO: initialize the admin actor.
@@ -132,6 +132,7 @@ public:
void delete_client(UniqueClient &client) {
stdostream() << "Client closed: actor id=" << client->actor_id_ << std::endl;
master_->disconnected(client->actor_id_);
client.reset();
}
@@ -209,7 +210,7 @@ public:
if (chan == nullptr) break;
if (chan->port() == 8085) {
Client *client = new Client;
client->actor_id_ = master_->create_login_actor(true);
client->actor_id_ = master_->create_login_actor();
// TODO: initialize the login actor on the master.
client->channel_ = std::move(chan);
client->async_diff_ = true;
@@ -217,7 +218,7 @@ public:
client->sync_.reset(new World(WORLD_TYPE_PREDICTIVE));
// This login actor is never used, it is just to preserve the invariant that
// the client model and the server synchronous model are identical.
client->sync_->create_login_actor(false);
client->sync_->create_login_actor();
clients_.emplace_back(client);
stdostream() << "New client: actor id=" << client->actor_id_ << std::endl;
} else if (chan->port() == 8080) {