19 lines
438 B
Rust
19 lines
438 B
Rust
|
use std::rc::Rc;
|
||
|
|
||
|
use crate::{state::Effect, world::{Town, Structure}, state::GameState};
|
||
|
|
||
|
pub struct FoundTown{
|
||
|
pub x: usize,
|
||
|
pub y: usize,
|
||
|
pub town: Rc<Town>,
|
||
|
}
|
||
|
|
||
|
impl Effect for FoundTown {
|
||
|
fn apply(&self, state: &mut GameState) {
|
||
|
state.world.add_structure(self.x, self.y, Structure::Town(self.town.clone()));
|
||
|
}
|
||
|
|
||
|
fn description(&self) -> String {
|
||
|
format!("{} was founded", self.town.name)
|
||
|
}
|
||
|
}
|