Hands-on Rust: Various Typos/Notes B3.0

The last issue in this set is more serious so I thought I would get it in in case you have not already had it reported.

p207 Instructions
Updating the Map
“Open systems/movement.rs and apply the following changes:”
I see no difference in the first code snippet from the previous code.
Subsequently I realized you were probably trying to show a few more lines to show a change to
#[resource] map: &mut Map,
(adding mut so we can update map.revealed_tiles)

p210 typo
“Red tints could represent heat signatures in a suspenseful &lquot;bug hunt&rquot; game.”

p213 Instructions
There has been no mention (so far) of replacing the code for placing YALA in the build function with a call to find most distant. The refactor is mentioned but not really completed.
mb.amulet_start = mb.find_most_distant();

p215 - p217 Instructions
Ran into more serious trouble. Reference Implemetation was not working as expected. Got to a working state as follows:
First, on p215 the code snippet includes monster_spawns which is not in the previous MapBuilder struct (but is in your code). So instructions are missing this change to mod.rs.
Second, there is no instruction to add the following to mod.rs
mod empty;
use empty::EmptyArchitect;
(it is in your code archive)
And without that, acrhitect cannot be set to EmptyArchitect in the build function.
Once I got that in, when I tried it, I got no monsters or amulet spawned.
I got the amulet to spawn if I set the spawn point to be something other than the player position:
mb.amulet_start = Point::new((SCREEN_WIDTH/2)+1, (SCREEN_HEIGHT/2)+1);
I got the monsters to spawn once I copied
map_builder.monster_spawns
.iter()
.for_each(|pos| spawn_monster(&mut ecs, &mut rng, *pos));
from your archive code into main.rs.
So that needs to be added to the instructions as well.

1 Like