Pravda

Check-in [51d2b8d26e]
Login

Check-in [51d2b8d26e]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixed some warnings and comments.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA3-256: 51d2b8d26e5109d96ebb73c3220c80247102c6f440916ea10acf125aee084828
User & Date: david 2024-03-27 08:03:03
Context
2024-03-27
08:03
Fixed some warnings and comments. Leaf check-in: 51d2b8d26e user: david tags: trunk
2024-03-26
09:06
Adapting the structure to deal with more complex games and merging Spoof, but not ready yet. check-in: 223ad50bdb user: david tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/rps.rs.

91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
    /// HashSet indicating for each player which match they are in.
    players: HashMap<String, usize>,
}

impl Game for Rps {
    /// Creation of a new and empty Rps game structure.
    fn new(
        c: tokio::sync::mpsc::UnboundedSender<GameEvent>,
        token: tokio_util::sync::CancellationToken,
    ) -> Self {
        Rps {
            lobby: HashSet::new(),
            capacity: 2,
            matches: Vec::new(),
            players: HashMap::new(),
        }







|
|







91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
    /// HashSet indicating for each player which match they are in.
    players: HashMap<String, usize>,
}

impl Game for Rps {
    /// Creation of a new and empty Rps game structure.
    fn new(
        _c: tokio::sync::mpsc::UnboundedSender<GameEvent>,
        _token: tokio_util::sync::CancellationToken,
    ) -> Self {
        Rps {
            lobby: HashSet::new(),
            capacity: 2,
            matches: Vec::new(),
            players: HashMap::new(),
        }

Changes to src/spoof.rs.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

/// Data structure of the game.
pub struct Spoof {
    /// name of the game.
    name: String,
    /// A HashSet with the players waiting to play as account strings.
    lobby: HashSet<String>,
    /// capacity determines  how many people a match contains.
    capacity: u8,
    /// A vector of ongoing matches.
    matches: Vec<Match>,
    /// HashSet indicating for each player which match they are in.
    players: HashMap<String, usize>,
    /// This channel is the way for the game to ask the main event loop to send it an internal command.
    channel: tokio::sync::mpsc::UnboundedSender<GameEvent>,







|







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

/// Data structure of the game.
pub struct Spoof {
    /// name of the game.
    name: String,
    /// A HashSet with the players waiting to play as account strings.
    lobby: HashSet<String>,
    /// capacity determines  how many people can fit in the lobby.
    capacity: u8,
    /// A vector of ongoing matches.
    matches: Vec<Match>,
    /// HashSet indicating for each player which match they are in.
    players: HashMap<String, usize>,
    /// This channel is the way for the game to ask the main event loop to send it an internal command.
    channel: tokio::sync::mpsc::UnboundedSender<GameEvent>,