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 | 7f49436baea5d29586c7ac10c4586ef59d788e5d (patch) | |
tree | bd869e0b981faa3a05f8069fcd8254ec0ead208e /server.c | |
parent | Add simplified speed control (diff) | |
download | torus-7f49436baea5d29586c7ac10c4586ef59d788e5d.tar.gz torus-7f49436baea5d29586c7ac10c4586ef59d788e5d.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 ad9815b..356387f 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); } |