Skip to main content

nil_core/world/cheat/
round.rs

1// Copyright (C) Call of Nil contributors
2// SPDX-License-Identifier: AGPL-3.0-only
3
4use crate::bail_if_cheats_are_not_allowed;
5use crate::error::Result;
6use crate::world::World;
7use std::num::NonZeroU8;
8
9impl World {
10  pub fn cheat_skip_round(&mut self, amount: NonZeroU8) -> Result<()> {
11    bail_if_cheats_are_not_allowed!(self);
12
13    if !self.round.is_idle() {
14      let amount = amount.get();
15      for i in 1..=amount {
16        self.dangerously_end_round(i == amount)?;
17      }
18    }
19
20    Ok(())
21  }
22}