Closed zwrawr closed 7 years ago
Link to method: https://github.com/TeamPorcupine/ProjectPorcupine/blob/master/Assets/Scripts/Pathfinding/Path_AStar.cs#L28-L156
I'm not sure I agree that this method needs splitting up unless you can come up with a good reason (like if the split up code is or can be reused elsewhere).
It would defiantly improve readability and would probably improve test ability. But your point stands that currently non of that code is reused.
The pathfinding is pretty much a single unit. But there are a lot of blank lines and a few multiline comments that could be removed.
I would love to pull out the stuff for finding furniture and items and just have the path a* deal with finding the path.
@zwrawr This is probably not a good idea.
The path finding needs a rewrite for speed, and I believe @WardBenjamin has started on a different algorithm entirely. Rewriting it for less complexity to read is going to be a temporary measure at best.
@mattpott is correct. The path finding should be a tool we use to find the walkable path or distance from A to B, not who we ask to find things. I know it's there so that we can find the guaranteed closest item, but it should still be the InventoryManager that asks, not the opposite.
I think this Issue cursed me. I looked at the code because I'm doing a refactoring and I can't stand that it has two different ways of operating. I'm splitting some off it up. I'll close this issue with that PR.
Oh my I just realized that the A_Star class does so much more than an a star search....
It does too much, but yes.
I recommend closing this.
Closing in favor of a new pathfinder coming in the close future.
Path_AStar.Path_AStar(World world, Tile tileStart, Tile tileEnd, string objectType = null, int desiredAmount = 0, bool canTakeFromStockpile = false, bool lookingForFurn = false)
method goes from line 28 to line 160.