From f19ccb4fe2efd948b3e2276679c7dc11afb0142e Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 16 Dec 2024 14:37:27 +0100 Subject: fix(ecs): make World::default fn behave same as World::new fn --- ecs/src/lib.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ecs/src/lib.rs b/ecs/src/lib.rs index 334fe69..3926344 100644 --- a/ecs/src/lib.rs +++ b/ecs/src/lib.rs @@ -55,7 +55,7 @@ pub use ecs_macros::{Component, Sole}; pub use crate::query::Query; -#[derive(Debug, Default)] +#[derive(Debug)] pub struct World { data: WorldData, @@ -68,7 +68,11 @@ impl World #[must_use] pub fn new() -> Self { - let mut world = Self::default(); + let mut world = Self { + data: WorldData::default(), + stop: AtomicBool::new(false), + is_first_tick: AtomicBool::new(false), + }; world.add_sole(Stats::default()).ok(); @@ -469,6 +473,14 @@ impl World } } +impl Default for World +{ + fn default() -> Self + { + Self::new() + } +} + /// The result of calling [`World::step`]. pub enum StepResult { -- cgit v1.2.3-18-g5258