paulofmandown / rotLove

Roguelike Toolkit in Love. A Love2D/lua port of rot.js
http://paulofmandown.github.io/rotLove/
Other
258 stars 25 forks source link

DijkstraMap overhaul #53

Closed airstruck closed 7 years ago

airstruck commented 7 years ago

Made DijkstraMap conform to Path interface, and extend Path. No longer needs width and height, it flood-fills outwards. Added a bunch of tests. Should also be much faster now (not perf'd yet though).

This includes some API changes. Got rid of getMap and getGoals, since _map and _goals shouldn't be public now (need to manage access so we can set dirty flag). Should be enough other methods to provide appropriate access to these; if not more can be added.

Related: https://github.com/ondras/rot.js/issues/78#issuecomment-318939273

This is a pretty major overhaul (git doesn't recognize it as the same file after moving it), so please let me know if I broke anyone's code outside of API changes.