error on not enough cards
This commit is contained in:
parent
db180a66ed
commit
1da5606dd6
1 changed files with 6 additions and 2 deletions
|
@ -148,9 +148,13 @@ impl Game {
|
|||
tracing::debug!("Player is czar");
|
||||
Err("You can't submit cards to judge, you ARE the judge!".to_string())
|
||||
} else {
|
||||
// Error if not enough cards
|
||||
if request.card_ids.len() < self.current_black.pick.into() {
|
||||
return Err("You didn't pick enough cards!".to_string());
|
||||
}
|
||||
|
||||
// Ignore extra cards
|
||||
let trimmed = request.card_ids[..self.current_black.pick.into()].to_vec();
|
||||
// TODO: handle not enough cards
|
||||
tracing::debug!("Trimmed: {:#?}", trimmed);
|
||||
|
||||
// Move card from player's hand to judge pile
|
||||
|
@ -243,7 +247,7 @@ impl Game {
|
|||
tracing::debug!("{:#?}", self.rotation);
|
||||
tracing::debug!("{:#?}", self.rotation_index);
|
||||
// Choose new czar
|
||||
if self.rotation_index == self.rotation.len() {
|
||||
if self.rotation_index == self.rotation.len() - 1 {
|
||||
self.rotation_index = 0;
|
||||
} else {
|
||||
self.rotation_index += 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue