gameServer2/src/server/handlers/loggingin.rs
author nemo
Sun, 29 Apr 2018 09:24:14 -0400
changeset 13347 e7b89e87a1b3
parent 13119 1e39b8749072
child 13416 cdf69667593b
permissions -rw-r--r--
Airmines should have been set for 45° bounce - the only reason they weren't I guess is they were a clone of some mine values - and mines use traditional behaviour.

use mio;

use server::server::HWServer;
use server::actions::Action;
use server::actions::Action::*;
use protocol::messages::HWProtocolMessage;
use protocol::messages::HWServerMessage::*;

pub fn handle(server: & mut HWServer, token: usize, message: HWProtocolMessage) {
    match message {
        HWProtocolMessage::Nick(nick) =>
            if server.clients[token].room_id == None {
                server.react(token, vec![SendMe(Nick(nick.clone()))]);
                server.clients[token].nick = nick;
                server.react(token, vec![CheckRegistered]);
            },
        HWProtocolMessage::Proto(proto) => {
            server.clients[token].protocol_number = proto;
            server.react(token, vec![CheckRegistered]);
        },
        _ => warn!("Incorrect command in logging-in state"),
    }
}