amethyst / amethyst/rustrogueliketutorial

C23. spawn_entities does not need map depth

Đang mở
#127 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
970
Fork
166
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.