New Pathfinder - PathFinder.CostMatrix issue


  • Culture

    After deserializing a matrix using the methods http://support.screeps.com/hc/en-us/articles/207023879-PathFinder#deserialize  you can't call "get(x,y)" on the returned object.

    You will get the following error:

    TypeError: matrix.get is not a function

     

    Trying to log the matrix to console using console.log("Matrix: " + matrix) produces the following error:

    Function.prototype.toString is not generic"

     

    I'm currently testing this on PTR, have not tried in PROD


  • Culture

    Additional information:

    Matrix is created using:

    var mtrx = new PathFinder.CostMatrix;
    // do magic
    Memory.<something> = mtrx.serialize(); 

    Later in code it's deserialized:

    var someMatrix = PathFinder.CostMatrix.deserialize(Memory.<something>);
    matrix.get(20,20) // ERROR
    console.log(someMatrix) // ERROR

     

    Reproduction code:

    var mtrx = new PathFinder.CostMatrix;
    console.log(mtrx);
    var value = mtrx.get(20, 20);
    var data = mtrx.serialize();
    console.log(value + ' - ' + mtrx);
    var deserializedMatrix = PathFinder.CostMatrix.deserialize(data);
    value = deserializedMatrix.get(20, 20);
    console.log(value + ' - ' + deserializedMatrix);

  • Dev Team

    Thanks for reporting, fixed.