Skip to content

Commit e9762ac

Browse files
committed
Do not implement diagonals in get_available_exits early
The diagonal directions in the `get_available_exits` function is does not need to be implemented until later in the chapters, and is done so [here](https://github.com/thebracket/rustrogueliketutorial/blob/master/book/src/chapter_7.md#allowing-diagonal-movement). This PR cleans up the earlier implementation so that the reader doesnt get confused by an early implementation of diagonals that is not needed.
1 parent 48fe3d5 commit e9762ac

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

book/src/chapter_7.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ fn get_available_exits(&self, idx:usize) -> rltk::SmallVec<[(usize, f32); 10]> {
4242
if self.is_exit_valid(x, y-1) { exits.push((idx-w, 1.0)) };
4343
if self.is_exit_valid(x, y+1) { exits.push((idx+w, 1.0)) };
4444

45-
// Diagonals
46-
if self.is_exit_valid(x-1, y-1) { exits.push(((idx-w)-1, 1.45)); }
47-
if self.is_exit_valid(x+1, y-1) { exits.push(((idx-w)+1, 1.45)); }
48-
if self.is_exit_valid(x-1, y+1) { exits.push(((idx+w)-1, 1.45)); }
49-
if self.is_exit_valid(x+1, y+1) { exits.push(((idx+w)+1, 1.45)); }
50-
5145
exits
5246
}
5347
```

0 commit comments

Comments
 (0)