The build_corridors function introduces the sort_by utility in Vec. The call appears like this:
build_corridors
sort_by
Vec
rooms.sort_by(|a,b| a.center().x.cmp(&b.center().x));
I believe it would help readers understanding why a is used directly, whereas &b is referenced.
a
&b
Thanks again! I’ve added this to the “mysterious future” bug tracker; if there’s a 2nd edition, it’ll be on my task list. I hope you’re enjoying the book.
Thank you! Very enjoyable book, very didactic, and a pleasant look into whole game developments (never wrote a game; clearly challenging) !