1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Resolved Distance bug

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

  1. Hazard

    Joined:
    Apr 18, 2015
    Messages:
    408
    Likes Received:
    84
    @Cloud @Arbiter
    [​IMG]

    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.
    [​IMG]

    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. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    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. Hazard

    Joined:
    Apr 18, 2015
    Messages:
    408
    Likes Received:
    84
    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. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    So just to confirm, it was a bug in your code.
     
  6. Hazard

    Joined:
    Apr 18, 2015
    Messages:
    408
    Likes Received:
    84
    Probaby, I could revert it to the old code to verify it if you want me to?
     

Share This Page

Loading...