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
Lobby! #1
Conversation
src/client.rs
Outdated
name: Option<String>, | ||
in_game: bool, | ||
game_slot: Option<String>, // None iff. in_game is false |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 :/"); |
There was a problem hiding this comment.
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!()
?
There was a problem hiding this comment.
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!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
There was a problem hiding this 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.
dba34c6
to
cf41f57
Compare
@Manghi fixed, please re-review! |
@AaronM04 Approved for merge. Thanks for the great work! |
Hooray! Thanks for reviewing! |
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
Support for:
Rudimentary (wrong lol) handling of server OK responses via
last_req_action
field in client state.