ondras / rot.js

ROguelike Toolkit in JavaScript. Cool dungeon-related stuff, interactive manual, documentation, tests!
https://ondras.github.io/rot.js/hp/
BSD 3-Clause "New" or "Revised" License
2.34k stars 255 forks source link

Cellular with { topology: 6 } and display with { layout: "hex" } include malformed coordinates. #73

Closed blinks closed 9 years ago

blinks commented 9 years ago
    var display = new ROT.Display({ layout: "hex" });
    var mapGen = new ROT.Map.Cellular(null, null, {
        topology: 6,
        born: [4, 5, 6],
        survive: [3, 4, 5, 6]
    });

If I then call mapGen.create, I get 1s where walls exist and 0s both in legal empty hexes and in illegal locations. By the latter, I mean that if I have the display draw at each coordinate that comes out of the map, it'll have many overlapping hexes.

While a simple workaround for the walls is to only store 1s, that doesn't allow me to determine a good coordinate for placing the player. I assume there's some good way to filter it on my end (perhaps only even/odd x coords should be accepted), but it'd be better if the map generator didn't output those coords.

ondras commented 9 years ago

Hi @blinks, this looks like a fair issue. I will investigate.

ondras commented 9 years ago

Should be fixed in https://github.com/ondras/rot.js/commit/658a7b2b76b1d69633b8de06b13be56bd1ed31b8. @blinks, can you confirm please?

blinks commented 9 years ago

Confirmed! Many thanks for the quick response.