The failure occurs in the every second loop in the hunter while trying to update the path. In the function DecisionMaking::getAStarPath, the get call (line 112) catch an exception (null object reference).
public function get(x:Int,y:Int):String
{
return this.map[y].substr(x,1);
}
So I have 2 cases to explore (x, y) can't be null (integer) :
- this is null
- this.map[y] is null
I seriously doubt that this is null, because in getAStarPath the object is just created before the call.
public static function getAStarPath(map:String,fx:Int,fy:Int,tx:Int,ty:Int,dg:Int):String
{
return new AStar(map).from(fx,fy).to(tx,ty,dg).path();
}
The line 162 is:
var id=get(vx,vy);
I fear 2 things:
- a context lost in the time loop (map variable is unknown)
- a round problem on vx,vy => need to add a round in the call block (path for map row/col parameters) and/or check the coordinate ranges.
My idea is that true compiled versions (C => windows, osx,...) work because of the int cast and pseudo compiled (or interpreted) (flash and javascript) doesn't because they used float. May be the add of 2 rounds in the "get path" can help. I will test this as soon as I'm up.
Don't even imagine where I was during this brainstorm... LOL (now going back to bed)