gameServer2/src/server/client.rs
author alfadur
Sat, 07 Jul 2018 20:22:31 +0300
changeset 13483 d79795acaa73
parent 13482 f748a72432f2
child 13525 1ee192f13456
permissions -rw-r--r--
Mostly implement voting
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13483
d79795acaa73 Mostly implement voting
alfadur
parents: 13482
diff changeset
     1
use super::coretypes::ClientId;
12133
f50876f3eff8 Refactor modules layout
unc0rr
parents:
diff changeset
     2
f50876f3eff8 Refactor modules layout
unc0rr
parents:
diff changeset
     3
pub struct HWClient {
13124
1e39b8749072 separated the server logic from all the async io mess.
alfadur
parents: 12858
diff changeset
     4
    pub id: ClientId,
12857
bd35cb2302b3 Quick dirty fix for building
unc0rr
parents: 12152
diff changeset
     5
    pub room_id: Option<usize>,
12146
78925eff02c2 Basic support for NICK message
unc0rr
parents: 12144
diff changeset
     6
    pub nick: String,
12151
8d8fb85bc09c SendAllButMe action, list all clients in lobby in LobbyJoined message to newcomers
unc0rr
parents: 12149
diff changeset
     7
    pub protocol_number: u32,
13482
f748a72432f2 Implement greetings & fixed rooms
alfadur
parents: 13428
diff changeset
     8
    pub is_admin: bool,
12152
03ccb89820f3 Room creation halfplemented
unc0rr
parents: 12151
diff changeset
     9
    pub is_master: bool,
03ccb89820f3 Room creation halfplemented
unc0rr
parents: 12151
diff changeset
    10
    pub is_ready: bool,
13428
87a6cad20c90 Implement game start & engine messages
alfadur
parents: 13424
diff changeset
    11
    pub is_in_game: bool,
13424
81e0ed105f5d implementation of team related messages
alfadur
parents: 13124
diff changeset
    12
    pub teams_in_game: u8,
13428
87a6cad20c90 Implement game start & engine messages
alfadur
parents: 13424
diff changeset
    13
    pub team_indices: Vec<u8>,
13424
81e0ed105f5d implementation of team related messages
alfadur
parents: 13124
diff changeset
    14
    pub clan: Option<u8>,
12152
03ccb89820f3 Room creation halfplemented
unc0rr
parents: 12151
diff changeset
    15
    pub is_joined_mid_game: bool,
12133
f50876f3eff8 Refactor modules layout
unc0rr
parents:
diff changeset
    16
}
f50876f3eff8 Refactor modules layout
unc0rr
parents:
diff changeset
    17
f50876f3eff8 Refactor modules layout
unc0rr
parents:
diff changeset
    18
impl HWClient {
13124
1e39b8749072 separated the server logic from all the async io mess.
alfadur
parents: 12858
diff changeset
    19
    pub fn new(id: ClientId) -> HWClient {
12133
f50876f3eff8 Refactor modules layout
unc0rr
parents:
diff changeset
    20
        HWClient {
13124
1e39b8749072 separated the server logic from all the async io mess.
alfadur
parents: 12858
diff changeset
    21
            id,
12151
8d8fb85bc09c SendAllButMe action, list all clients in lobby in LobbyJoined message to newcomers
unc0rr
parents: 12149
diff changeset
    22
            room_id: None,
12146
78925eff02c2 Basic support for NICK message
unc0rr
parents: 12144
diff changeset
    23
            nick: String::new(),
12151
8d8fb85bc09c SendAllButMe action, list all clients in lobby in LobbyJoined message to newcomers
unc0rr
parents: 12149
diff changeset
    24
            protocol_number: 0,
13482
f748a72432f2 Implement greetings & fixed rooms
alfadur
parents: 13428
diff changeset
    25
            is_admin: false,
12152
03ccb89820f3 Room creation halfplemented
unc0rr
parents: 12151
diff changeset
    26
            is_master: false,
03ccb89820f3 Room creation halfplemented
unc0rr
parents: 12151
diff changeset
    27
            is_ready: false,
13428
87a6cad20c90 Implement game start & engine messages
alfadur
parents: 13424
diff changeset
    28
            is_in_game: false,
13424
81e0ed105f5d implementation of team related messages
alfadur
parents: 13124
diff changeset
    29
            teams_in_game: 0,
13428
87a6cad20c90 Implement game start & engine messages
alfadur
parents: 13424
diff changeset
    30
            team_indices: Vec::new(),
13424
81e0ed105f5d implementation of team related messages
alfadur
parents: 13124
diff changeset
    31
            clan: None,
12152
03ccb89820f3 Room creation halfplemented
unc0rr
parents: 12151
diff changeset
    32
            is_joined_mid_game: false,
12133
f50876f3eff8 Refactor modules layout
unc0rr
parents:
diff changeset
    33
        }
f50876f3eff8 Refactor modules layout
unc0rr
parents:
diff changeset
    34
    }
13124
1e39b8749072 separated the server logic from all the async io mess.
alfadur
parents: 12858
diff changeset
    35
}