Skip to main content

nil_core/world/infrastructure/
mod.rs

1// Copyright (C) Call of Nil contributors
2// SPDX-License-Identifier: AGPL-3.0-only
3
4mod building;
5mod storage;
6
7use crate::continent::Coord;
8use crate::error::Result;
9use crate::infrastructure::building::BuildingId;
10use crate::world::World;
11
12impl World {
13  pub fn toggle_building(&mut self, coord: Coord, id: BuildingId, enabled: bool) -> Result<()> {
14    self
15      .continent
16      .city_mut(coord)?
17      .infrastructure_mut()
18      .building_mut(id)
19      .toggle(enabled);
20
21    self.emit_city_updated(coord);
22
23    Ok(())
24  }
25}