Resolved Distance bug

Discussion in 'Client & Site Support' started by Hazard, Jul 4, 2015.

  1. @Cloud @Arbiter

    boolean Dist = coordinate1.equals(coordinate2));
    double Realdist = coordinate1.distanceTo(coordinate2);

    @SlashnHax pointed out that the value for Realdist in the picture is the max double.

    To me it's logical that dist returns false too since the distance is not zero.

    Temporary fixed it by comparing the x/y values.

    #1 Hazard, Jul 4, 2015
    Last edited: Jul 4, 2015
  2. Best Answer:
    Post #3 by Hazard, Jul 5, 2015
  3. Conditions where it could return Double.MAX_VALUE
    1) The start or destination entity are equal to null
    2) start.getArea() or destination.getArea() return null
    3) startArea.getCenter() or destinationArea.getCenter() returns null, or the planes of the center coordinates don't match.

    Can you test all of these conditions for me and see if any don't match? Also regarding .equals not matching, the condition is that they're both instances of Coordinate and that their hashcode's match.
    #2 Cloud, Jul 5, 2015
    Last edited: Jul 5, 2015
  4. I'm gonna guess it was a caching problem since sometimes getPosition() returned null as well(as in while doing the floor the object got de-cached, and when requesting the old gameobject it didn't exist anymore).
    I fixed it thanks to @Aidden by storing the location instead of the gameobject when constructing my Door class and doing GameObjects#getLoadedAt(previouslyStoredLocation)
  5. So just to confirm, it was a bug in your code.
  6. Probaby, I could revert it to the old code to verify it if you want me to?

Share This Page