rot.js icon indicating copy to clipboard operation
rot.js copied to clipboard

Recursive Shadowcasting range

Open mingos777 opened this issue 6 years ago • 1 comments

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.

mingos777 avatar Dec 16 '18 14:12 mingos777

Good find!

/cc @thesnarky1, because he is the author of the Recursive Shadowcasting impl.

ondras avatar Dec 16 '18 14:12 ondras