Hands-on Rust: Missing code change to render the map with camera (page 113 in P1.0)

When introducing the camera, compilation errs as the change to the map’s render method is not reflected in src/main.rs, if just following the flow of the text.

Perhaps the next can just add the change on p113, from:

self.map.render(ctx);

To:

self.map.render(ctx, &self.camera);

In the state’s impl of the GameState trait.

1 Like

Thanks! Now that it’s in-print, I can’t readily make changes - so I’ve noted this down. If there’s a 2nd edition in the future, it’ll be included then.

Thank you, Herbert. Very enjoyable book, and saw my comments are too late in the pipeline.

Just noticed the problem reported here is addressed page 114 (P1.0 of the PDF version), also addressing similar issue with the player struct. IN:

fn tick(&mut self, ctx: &mut BTerm) { ctx.set_active_console(0);
  ctx.cls();
  ctx.set_active_console(1);
  ctx.cls();
  self.player.update(ctx, &self.map, &mut self.camera);
  self.map.render(ctx, &self.camera);
  self.player.render(ctx, &self.camera);
}

So the problem would only happen with readers who code and run piece by piece (but you do propose to run the program after each piece; this may be the main reason to report). So keeping on reading is just fine on P1.0!

Thank you again for this very enjoyable book.