rust/hedgewars-server/src/handlers/checker.rs
author alfadur
Wed, 27 Mar 2024 02:19:44 +0300
changeset 16030 8ba2b5007c29
parent 15904 f185e7367dd3
permissions -rw-r--r--
fix leaving rooms
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15141
febccab419b1 Apply dos2unix to rust sources
unc0rr
parents: 15096
diff changeset
     1
use log::*;
febccab419b1 Apply dos2unix to rust sources
unc0rr
parents: 15096
diff changeset
     2
15904
f185e7367dd3 Add some work towards having checker work with the new server
unC0Rr
parents: 15870
diff changeset
     3
use crate::core::{server::HwServer, types::CheckerId};
15826
747278149393 Extract network protocol into a separate crate
unc0rr
parents: 15141
diff changeset
     4
use hedgewars_network_protocol::messages::HwProtocolMessage;
15141
febccab419b1 Apply dos2unix to rust sources
unc0rr
parents: 15096
diff changeset
     5
15870
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15853
diff changeset
     6
pub fn handle(
15904
f185e7367dd3 Add some work towards having checker work with the new server
unC0Rr
parents: 15870
diff changeset
     7
    server: &mut HwServer,
f185e7367dd3 Add some work towards having checker work with the new server
unC0Rr
parents: 15870
diff changeset
     8
    checker_id: CheckerId,
15870
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15853
diff changeset
     9
    _response: &mut super::Response,
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15853
diff changeset
    10
    message: HwProtocolMessage,
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15853
diff changeset
    11
) {
15141
febccab419b1 Apply dos2unix to rust sources
unc0rr
parents: 15096
diff changeset
    12
    match message {
15870
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15853
diff changeset
    13
        HwProtocolMessage::CheckerReady => {
15904
f185e7367dd3 Add some work towards having checker work with the new server
unC0Rr
parents: 15870
diff changeset
    14
            server
f185e7367dd3 Add some work towards having checker work with the new server
unC0Rr
parents: 15870
diff changeset
    15
                .get_checker_mut(checker_id)
f185e7367dd3 Add some work towards having checker work with the new server
unC0Rr
parents: 15870
diff changeset
    16
                .map(|c| c.set_is_ready(true));
15870
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15853
diff changeset
    17
            warn!("Unimplemented")
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15853
diff changeset
    18
        }
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15853
diff changeset
    19
        HwProtocolMessage::CheckedOk(info) => {
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15853
diff changeset
    20
            warn!("Unimplemented")
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15853
diff changeset
    21
        }
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15853
diff changeset
    22
        HwProtocolMessage::CheckedFail(message) => {
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15853
diff changeset
    23
            warn!("Unimplemented")
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15853
diff changeset
    24
        }
15141
febccab419b1 Apply dos2unix to rust sources
unc0rr
parents: 15096
diff changeset
    25
        _ => warn!("Unknown command"),
febccab419b1 Apply dos2unix to rust sources
unc0rr
parents: 15096
diff changeset
    26
    }
febccab419b1 Apply dos2unix to rust sources
unc0rr
parents: 15096
diff changeset
    27
}