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
9pub fn skip_round(world: &mut World, amount: NonZeroU8) -> Result<()> {
10  bail_if_cheats_are_not_allowed!(world);
11
12  if !world.round.is_idle() {
13    let amount = amount.get();
14    for i in 1..=amount {
15      world.dangerously_end_round(i == amount)?;
16    }
17  }
18
19  Ok(())
20}