wip (tests fails)
This commit is contained in:
parent
56d155b911
commit
c1e99a5f35
4 changed files with 24 additions and 7 deletions
|
|
@ -338,7 +338,7 @@ impl GameState {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
Roll { player_id } | RollResult { player_id, dice: _ } => {
|
||||
Roll { player_id } => {
|
||||
// Check player exists
|
||||
if !self.players.contains_key(player_id) {
|
||||
return false;
|
||||
|
|
@ -347,6 +347,26 @@ impl GameState {
|
|||
if self.active_player_id != *player_id {
|
||||
return false;
|
||||
}
|
||||
// Check the turn stage
|
||||
if self.turn_stage != TurnStage::RollWaiting {
|
||||
error!("bad stage {:?}", self.turn_stage);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
RollResult { player_id, dice: _ } => {
|
||||
// Check player exists
|
||||
if !self.players.contains_key(player_id) {
|
||||
return false;
|
||||
}
|
||||
// Check player is currently the one making their move
|
||||
if self.active_player_id != *player_id {
|
||||
return false;
|
||||
}
|
||||
// Check the turn stage
|
||||
if self.turn_stage != TurnStage::RollDice {
|
||||
error!("bad stage {:?}", self.turn_stage);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Mark {
|
||||
player_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue