b3dgs / lionengine

Java 2D Game Engine
http://lionengine.b3dgs.com
GNU General Public License v3.0
139 stars 23 forks source link

StackOverflowError on PathFinderImpl.findPath #582

Closed SomeFire closed 5 years ago

SomeFire commented 5 years ago

Expected Behavior

Endpoint of path should be targeted at closest position to the clicked point.

Actual Behavior

In some cases if path is blocked - SOE happens.

Steps to Reproduce the Problem

See screenshot:

  1. Move 1 unit to the forest corner.
  2. Move second unit to near position.
  3. Try to move second unit to the corner (where cursor on screenshot).

Specifications

SomeFire commented 5 years ago
java.lang.StackOverflowError
    at com.b3dgs.lionengine.game.feature.tile.map.pathfinding.MapTilePathModel.isTileNotAvailable(MapTilePathModel.java:88)
    at com.b3dgs.lionengine.game.feature.tile.map.pathfinding.MapTilePathModel.isAreaAvailable(MapTilePathModel.java:408)
    at com.b3dgs.lionengine.game.feature.tile.map.pathfinding.MapTilePathModel.getClosestAvailableTile(MapTilePathModel.java:180)
    at com.b3dgs.lionengine.game.feature.tile.map.pathfinding.MapTilePathModel.getClosestAvailableTile(MapTilePathModel.java:398)
    at com.b3dgs.lionengine.game.feature.tile.map.pathfinding.PathFinderImpl.findPath(PathFinderImpl.java:255)
    at com.b3dgs.lionengine.game.feature.tile.map.pathfinding.PathFinderImpl.findPath(PathFinderImpl.java:260)
    at com.b3dgs.lionengine.game.feature.tile.map.pathfinding.PathFinderImpl.findPath(PathFinderImpl.java:260)
    at com.b3dgs.lionengine.game.feature.tile.map.pathfinding.PathFinderImpl.findPath(PathFinderImpl.java:260)