Implement strike timeout on server side
This commit is contained in:
@ -130,31 +130,31 @@ impl GameRulesConfigurationScreen {
|
||||
KeyCode::Char(c) if ('0'..='9').contains(&c) => {
|
||||
let val = c.to_string().parse::<usize>().unwrap_or_default();
|
||||
|
||||
if self.curr_field == EditingField::MapWidth {
|
||||
if self.rules.map_width <= MAX_MAP_WIDTH {
|
||||
self.rules.map_width *= 10;
|
||||
self.rules.map_width += val;
|
||||
}
|
||||
if self.curr_field == EditingField::MapWidth
|
||||
&& self.rules.map_width <= MAX_MAP_WIDTH
|
||||
{
|
||||
self.rules.map_width *= 10;
|
||||
self.rules.map_width += val;
|
||||
}
|
||||
|
||||
if self.curr_field == EditingField::MapHeight {
|
||||
if self.rules.map_height <= MAX_MAP_HEIGHT {
|
||||
self.rules.map_height *= 10;
|
||||
self.rules.map_height += val;
|
||||
}
|
||||
if self.curr_field == EditingField::MapHeight
|
||||
&& self.rules.map_height <= MAX_MAP_HEIGHT
|
||||
{
|
||||
self.rules.map_height *= 10;
|
||||
self.rules.map_height += val;
|
||||
}
|
||||
|
||||
if self.curr_field == EditingField::BoatsList {
|
||||
if self.rules.boats_list().len() < MAX_BOATS_NUMBER {
|
||||
self.rules.add_boat(val);
|
||||
}
|
||||
if self.curr_field == EditingField::BoatsList
|
||||
&& self.rules.boats_list().len() < MAX_BOATS_NUMBER
|
||||
{
|
||||
self.rules.add_boat(val);
|
||||
}
|
||||
|
||||
if self.curr_field == EditingField::StrikeTimeout {
|
||||
let mut timeout = self.rules.strike_timeout.unwrap_or(0);
|
||||
if timeout <= MAX_STRIKE_TIMEOUT {
|
||||
timeout *= 10;
|
||||
timeout += val;
|
||||
timeout += val as u64;
|
||||
self.rules.strike_timeout = Some(timeout);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user