The call to map_idx on the render function of map (let idx = map_idx(x, y) ; ) caused error ‘error[E0425]: cannot find function map_idx in this scope’ when building the Dungeon Crawl program for the very first time.
Fixed it by referring to ithe function as Self::map_idx(x, y) based on a Stack Overflow thread.
Also on page 81 when the map field is added to the State struct the second parameter previously passed as State { } to main_loop had to be changed to State::new().
Thanks for finding that! I’ve added the issues into the issue tracker and will have them resolved for the next beta.
Does the version in the downloadable code folder compile ok for you? It builds correctly on my system. I suspect that the book needs to be more explicit about where the map_idx function goes. It isn’t part of the Map implementation - it is a free function. From the map.rs file:
I am reading the book and typing the code for practice. I have not downloaded the code. I feel like I won’t understand what I am doing if I simply download and run the code.
Yes, I suspected that something I did caused this error and only I seem to have encountered this error because others who seem to be further along (I see some errata for chapter 6) had not raised this as an error. I figured you’d take one look at this and identify where the issue was. Thank you for the lesson :).