aboutsummaryrefslogtreecommitdiff
path: root/stockton-types/src/world.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:19 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:19 +0100
commit73d48fe3719b7bbef14a3cffaadabd55df4b4bf2 (patch)
treef8e6ecb0adf76292d19308948a687938fc0cf9f2 /stockton-types/src/world.rs
parent6ee3384750bb065e4397b02e2cc7f567f96da73a (diff)
feat(types): entity downcasting and fnmut in world creation
Diffstat (limited to 'stockton-types/src/world.rs')
-rw-r--r--stockton-types/src/world.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/stockton-types/src/world.rs b/stockton-types/src/world.rs
index f687f5e..18a0edf 100644
--- a/stockton-types/src/world.rs
+++ b/stockton-types/src/world.rs
@@ -1,3 +1,18 @@
+// Copyright (C) Oscar Shrimpton 2019
+
+// This program is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the Free
+// Software Foundation, either version 3 of the License, or (at your option)
+// any later version.
+
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this program. If not, see <http://www.gnu.org/licenses/>.
+
//! The thing you play on and all the associated state.
use crate::{EntityStore, Entity};
@@ -19,8 +34,8 @@ impl<'a> World<'a> {
/// Returns None if any entities in the map have name conflicts.
///
/// `mapper` is called for each BSPEntity to map it to a concrete rust type.
- pub fn new<F>(bsp: Pin<Box<BSPFile<'a>>>, mapper: F) -> Option<World<'a>>
- where F: Fn(&BSPEntity) -> (Box<Entity>, String) {
+ pub fn new<F>(bsp: Pin<Box<BSPFile<'a>>>, mut mapper: F) -> Option<World<'a>>
+ where F: FnMut(&BSPEntity) -> (Box<Entity>, String) {
let mut entities: Vec<(Box<Entity>, String)> = Vec::with_capacity(bsp.entities.entities.len());
for bsp_ent in bsp.entities.entities.iter() {