amethyst / amethyst/rustrogueliketutorial

C23. spawn_entities does not need map depth

未關閉
#127 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Rust
星號
970
分支
166
PR 合併指標
30 天內沒有已合併 PR

描述

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);
}
}
}
```

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。