fix: overflow when incrementing dice_roll_count
This commit is contained in:
parent
b92c9eb7ff
commit
cb30fd3229
|
|
@ -610,7 +610,9 @@ impl GameState {
|
||||||
|
|
||||||
fn inc_roll_count(&mut self, player_id: PlayerId) {
|
fn inc_roll_count(&mut self, player_id: PlayerId) {
|
||||||
self.players.get_mut(&player_id).map(|p| {
|
self.players.get_mut(&player_id).map(|p| {
|
||||||
|
if p.dice_roll_count < u8::MAX {
|
||||||
p.dice_roll_count += 1;
|
p.dice_roll_count += 1;
|
||||||
|
}
|
||||||
p
|
p
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue