diff --git a/AStarDLL/PreferredPath.cpp b/AStarDLL/PreferredPath.cpp index 31a4f85..58e7ec7 100644 --- a/AStarDLL/PreferredPath.cpp +++ b/AStarDLL/PreferredPath.cpp @@ -60,7 +60,7 @@ void PreferredPath::addPassagesToTable(Grid* grid) int horizontalWeight = (int)(weight * 127 * dx / (fabs(dx) + fabs(dy))); int verticalWeight = (int)(weight * 127 * dy / (fabs(dx) + fabs(dy))); - grid->visitGridModelLine(fromPos, toPos, [this, grid, horizontalWeight, verticalWeight, dx, dy, fromRow, fromCol, toRow, toCol](const Cell& cell) -> void { + grid->visitGridModelLine(fromPos, toPos, [this, grid, horizontalWeight, verticalWeight](const Cell& cell) -> void { AStarNode* node = grid->getNode(cell); AStarNodeExtraData * extra = grid->navigator->assertExtraData(cell, PreferredPathData); node->hasPreferredPathWeight = true; @@ -77,18 +77,6 @@ void PreferredPath::addPassagesToTable(Grid* grid) extra->bonusDown = (char)maxof(-128, minof(127, extra->bonusDown + fabs(verticalWeight))); } - bool isStart = cell.row == fromRow && cell.col == fromCol; - bool isEnd = cell.row == toRow && cell.col == toCol; - - if ((dx > 0 && !isEnd) || (isTwoWay && dx < 0 && !isStart)) - node->canGoRight = true; - if ((dx < 0 && !isEnd) || (isTwoWay && dx > 0 && !isStart)) - node->canGoLeft = true; - if ((dy > 0 && !isEnd) || (isTwoWay && dy < 0 && !isStart)) - node->canGoUp = true; - if ((dy < 0 && !isEnd) || (isTwoWay && dy > 0 && !isStart)) - node->canGoDown = true; - if (conditionRule) { node->hasConditionalBarrier = true; extra->addConditionalBarrier(this);