Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lobby! #1

Merged
merged 8 commits into from Apr 19, 2018
Merged

Lobby! #1

merged 8 commits into from Apr 19, 2018

Conversation

AaronM04
Copy link
Owner

Support for:

  • new game slot
  • join game slot
  • leave game slot
  • list players in game
  • list games
  • quit client

Rudimentary (wrong lol) handling of server OK responses via last_req_action field in client state.

@AaronM04 AaronM04 requested a review from Manghi April 17, 2018 05:01
src/client.rs Outdated
name: Option<String>,
in_game: bool,
game_slot: Option<String>, // None iff. in_game is false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if in_game is false when this is None, couldn't we simply have a function which checks if game_slot.is_some() to determine if we are in game?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right. I'll fix that. Thanks!

}
}
} else {
println!("OK, but we didn't make a request :/");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this does sound impossible, should we make it unreachable!()?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't impossible. You can't trust the network. In any case, we'll be removing this when we add support for dropped/reordered/duplicated packets.

} else { println!("ERROR: expected no arguments to leave"); }
}
"quit" => {
println!("Peace out!");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☮️ out yo

for ref mut gs in &mut self.game_slots {
if gs.game_slot_id == *game_slot_id {
// remove player_id from game slot's player_ids
gs.player_ids.retain(|&p_id| p_id != player.player_id);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retain 👍
used this myself today

Copy link
Collaborator

@Manghi Manghi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Very straightforward, though I see your previously mentioned concerns. Just be aware, that some of your implementations will change slightly as the chat branch has HashMaps for players and game slots.

Requested feedback on the questions I posed.

@AaronM04
Copy link
Owner Author

@Manghi fixed, please re-review!

@Manghi
Copy link
Collaborator

Manghi commented Apr 19, 2018

@AaronM04 Approved for merge. Thanks for the great work!

@Manghi Manghi merged commit c42d754 into master Apr 19, 2018
@AaronM04
Copy link
Owner Author

Hooray! Thanks for reviewing!

@AaronM04 AaronM04 deleted the aaronm04/lobby branch April 19, 2018 03:11
Manghi added a commit that referenced this pull request Apr 19, 2018
commit c42d754
Merge: 62b5d00 8ab7fed
Author: Manghi <Manghi@users.noreply.github.com>
Date:   Wed Apr 18 19:40:36 2018 -0700

    Merge pull request #1 from AaronM04/aaronm04/lobby

    Lobby!

commit 8ab7fed
Author: Aaron Miller <aaron.miller04@gmail.com>
Date:   Wed Apr 18 09:16:12 2018 -0700

    client: remove in_game

commit cf41f57
Author: Aaron Miller <aaron.miller04@gmail.com>
Date:   Tue Apr 17 08:47:09 2018 -0700

    client&server: no need to have udp_tx be part of the fold state

commit 7a53fcf
Author: Aaron Miller <aaron.miller04@gmail.com>
Date:   Tue Apr 17 08:09:34 2018 -0700

    client: update help message

commit c488aa0
Author: Aaron Miller <aaron.miller04@gmail.com>
Date:   Mon Apr 16 21:57:49 2018 -0700

    client: add checks to join,leave & add quit command

commit 693c521
Author: Aaron Miller <aaron.miller04@gmail.com>
Date:   Mon Apr 16 09:01:58 2018 -0700

    done with server checks; still need to do client checks

commit 3cce7a4
Author: Aaron Miller <aaron.miller04@gmail.com>
Date:   Sun Apr 15 17:24:20 2018 -0700

    server: implement leave, fix bugs in list players and join game slot, cleanup

commit 82f3fe1
Author: Aaron Miller <aaron.miller04@gmail.com>
Date:   Sun Apr 1 16:38:22 2018 -0700

    join, leave(client only for now), list players

commit b330ebc
Author: Aaron Miller <aaron.miller04@gmail.com>
Date:   Fri Mar 23 08:52:59 2018 -0700

    server: join game slot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants