From 86d46b8d5b917c5a34a076482c69ae0ac468c06d Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 2 Dec 2021 14:59:35 -0500 Subject: [PATCH] Fix some minor component issues --- src/components.rs | 12 +++--------- src/main.rs | 5 ++++- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/components.rs b/src/components.rs index dffe888..9c833b9 100644 --- a/src/components.rs +++ b/src/components.rs @@ -5,7 +5,7 @@ use specs::prelude::*; use specs::saveload::{ConvertSaveload, Marker}; use specs_derive::*; -#[derive(Component, ConvertSaveload, Clone)] +#[derive(Component, ConvertSaveload, Copy, Clone)] pub struct Position { pub x: i32, pub y: i32, @@ -13,19 +13,13 @@ pub struct Position { impl From<(i32, i32)> for Position { fn from(f: (i32, i32)) -> Self { - Position { - x: f.0, - y: f.1, - } + Position { x: f.0, y: f.1 } } } impl From for Position { fn from(p: Point) -> Self { - Position { - x: p.x, - y: p.y, - } + Position { x: p.x, y: p.y } } } diff --git a/src/main.rs b/src/main.rs index a83d20a..ad12221 100644 --- a/src/main.rs +++ b/src/main.rs @@ -547,7 +547,10 @@ fn main() -> rltk::BError { gs.ecs.insert(Map::new(1)); gs.ecs.insert(Point::zero()); gs.ecs.insert(rltk::RandomNumberGenerator::new()); - gs.ecs.insert(spawner::player(&mut gs.ecs, 0, 0)); + + let player_entity = spawner::player(&mut gs.ecs, 0, 0); + gs.ecs.insert(player_entity); + gs.ecs.insert(RunState::MapGeneration {}); gs.ecs.insert(GameLog::new("Welcome to Rusty Roguelike")); gs.ecs.insert(particle_system::ParticleBuilder::new());