amethyst / amethyst/rustrogueliketutorial

C23. spawn_entities does not need map depth

Open
#127 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
970
Forks
166
PR merge metrics
No merged PRs in 30d

Description

Both trait functions:
```rust
trait MapBuilder {
fn spawn(map : &Map, ecs : &mut World, new_depth: i32);
}
```
```rust
pub trait MapBuilder {
fn spawn_entities(&mut self, map : &Map, ecs : &mut World, new_depth: i32);
}
```
and
```rust
pub struct SimpleMapBuilder {
map : Map,
depth: i32
}
```
do not need `new_depth` parameter and `depth` member, as `depth` is [member of `Map`](https://github.com/thebracket/rustrogueliketutorial/blob/master/chapter-23-generic-map/src/map.rs#L23).

It could simply be:
```rust
impl MapBuilder for SimpleMapBuilder {
fn spawn(map: &mut Map, ecs: &mut World) {
for room in map.rooms.iter().skip(1) {
spawner::spawn_room(world, resources, room, map.depth);
}
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.