rot.js
rot.js copied to clipboard
Recursive Shadowcasting range
While testing Recursive Shadowcasting, I ran into an issue with its range treatment. I pass in Infinity
to the compute
method, hoping it will just stop when the map transparency is false. It does not and instead, it enters an infinite loop:
_castVisibility(...args) {
if (visSlopeStart < visSlopeEnd) { return; }
for (let i = row; i <= radius; i++) {
...
The for
loop above never terminates.
For the record, both Precise and Discrete accept Infinity
and terminate properly whenever the map says it's not transparent anymore.
Good find!
/cc @thesnarky1, because he is the author of the Recursive Shadowcasting impl.