diff options
author | June McEnroe <june@causal.agency> | 2019-01-04 13:22:21 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-01-04 13:22:21 -0500 |
commit | a2b5beb434b38aa8d0856166950053f8cf456f42 (patch) | |
tree | 546e8c17934ca27ad452183a215a4e8e39257da0 /server.c | |
parent | Add simplified speed control (diff) | |
download | torus-a2b5beb434b38aa8d0856166950053f8cf456f42.tar.gz torus-a2b5beb434b38aa8d0856166950053f8cf456f42.zip |
Add teleportation
"Spawns" in the old code.
Diffstat (limited to '')
-rw-r--r-- | server.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server.c b/server.c index 37f57ca..bd4e980 100644 --- a/server.c +++ b/server.c @@ -359,6 +359,16 @@ static bool clientMap(const struct Client *client) { return true; } +static bool clientTele(struct Client *client, uint8_t port) { + if (port >= ARRAY_LEN(Ports)) return false; + struct Client old = *client; + client->tileX = Ports[port].tileX; + client->tileY = Ports[port].tileY; + client->cellX = CellInitX; + client->cellY = CellInitY; + return clientUpdate(client, &old); +} + int main(int argc, char *argv[]) { int error; @@ -477,6 +487,9 @@ int main(int argc, char *argv[]) { break; case ClientMap: { success = clientMap(client); } + break; case ClientTele: { + success = clientTele(client, msg.port); + } } if (!success) clientRemove(client); } |