Merge branch 'master' of https://github.com/klangner/mapgen.rs
This commit is contained in:
commit
f6d1f2ac75
10
src/map.rs
10
src/map.rs
|
@ -111,15 +111,15 @@ impl Map {
|
||||||
let mut exits = Vec::new();
|
let mut exits = Vec::new();
|
||||||
|
|
||||||
// Cardinal directions
|
// Cardinal directions
|
||||||
if self.is_exit_valid(x-1, y) { exits.push((x-1, y, 1.0)) };
|
if x > 0 && self.is_exit_valid(x-1, y) { exits.push((x-1, y, 1.0)) };
|
||||||
if self.is_exit_valid(x+1, y) { exits.push((x+1, y, 1.0)) };
|
if self.is_exit_valid(x+1, y) { exits.push((x+1, y, 1.0)) };
|
||||||
if self.is_exit_valid(x, y-1) { exits.push((x, y-1, 1.0)) };
|
if y > 0 && self.is_exit_valid(x, y-1) { exits.push((x, y-1, 1.0)) };
|
||||||
if self.is_exit_valid(x, y+1) { exits.push((x, y+1, 1.0)) };
|
if self.is_exit_valid(x, y+1) { exits.push((x, y+1, 1.0)) };
|
||||||
|
|
||||||
// Diagonals
|
// Diagonals
|
||||||
if self.is_exit_valid(x-1, y-1) { exits.push((x-1, y-1, 1.45)); }
|
if x > 0 && y > 0 && self.is_exit_valid(x-1, y-1) { exits.push((x-1, y-1, 1.45)); }
|
||||||
if self.is_exit_valid(x+1, y-1) { exits.push((x+1, y-1, 1.45)); }
|
if y > 0 && self.is_exit_valid(x+1, y-1) { exits.push((x+1, y-1, 1.45)); }
|
||||||
if self.is_exit_valid(x-1, y+1) { exits.push((x-1, y+1, 1.45)); }
|
if x > 0 && self.is_exit_valid(x-1, y+1) { exits.push((x-1, y+1, 1.45)); }
|
||||||
if self.is_exit_valid(x+1, y+1) { exits.push((x+1, y+1, 1.45)); }
|
if self.is_exit_valid(x+1, y+1) { exits.push((x+1, y+1, 1.45)); }
|
||||||
|
|
||||||
exits
|
exits
|
||||||
|
|
Loading…
Reference in New Issue
Block a user