Javascript indexOf not working with neighbors

I was debugging my code and, for the life of me, couldn’t figure out what was wrong. When I finally found out what was wrong, my check for neighbors was failing when it shouldn’t. I decided to do a test and found some interesting results:

var t = this.getTile(0,0);
var t2 = this.getTile(0,1);
this.debug(t.neighbors.indexOf(t2));

I expect the debug output to be a positive number, but it’s yielding -1. This indicates that t.neighbors does not include tile (0,1), and therefore that (0,0) and (0,1) are not neighbors.

It’s a shame that I now have to implement my own check for neighbors manually.

Sorry darksteel, it sounds like this bug is still getting us: https://github.com/codecombat/aether/issues/77

Hopefully I can figure out a good solution soon.

It seems like your API protection has really never worked. I’ve seen bugs related to it like a hundred times.

Yes, it’s a hard problem, and we’ve never gotten it 100%.