amethyst / amethyst/rustrogueliketutorial

Town buildings are populated in wrong order

Aperta
#148 1 commento 4 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
970
Fork
166
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

My Player got spawned in a building so small, that it didn't even fit _Barkeep_, so I started investigating.

Code in _town.rs/building_factory_ is incorrect. It iterates over original `buildings` array, and uses its index to pick `build_type` form `building_index` array, which was sorted and has different indexing:
```rust
for (i, building) in buildings.iter().enumerate() {
let build_type = &building_index[i].2;
match build_type {
```

It should be changed to something like this:
```rust
for (i, _size, build_type) in building_index.iter() {
let building = &buildings[*i];
match build_type {
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.