Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions AStarDLL/PreferredPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down