Cleanup uses of SWAP macro (#8051)
This commit is contained in:
@@ -145,8 +145,8 @@ bool path_search_long(struct shootpath_data *spd,int16 m,int16 x0,int16 y0,int16
|
||||
|
||||
dx = (x1 - x0);
|
||||
if (dx < 0) {
|
||||
SWAP(x0, x1);
|
||||
SWAP(y0, y1);
|
||||
std::swap(x0, x1);
|
||||
std::swap(y0, y1);
|
||||
dx = -dx;
|
||||
}
|
||||
dy = (y1 - y0);
|
||||
@@ -198,13 +198,11 @@ bool path_search_long(struct shootpath_data *spd,int16 m,int16 x0,int16 y0,int16
|
||||
/// Pushes path_node to the binary node_heap.
|
||||
/// Ensures there is enough space in array to store new element.
|
||||
|
||||
#define swap_ptrcast_pathnode(a, b) swap_ptrcast(struct path_node *, a, b)
|
||||
|
||||
static void heap_push_node(struct node_heap *heap, struct path_node *node)
|
||||
{
|
||||
#ifndef __clang_analyzer__ // TODO: Figure out why clang's static analyzer doesn't like this
|
||||
BHEAP_ENSURE2(*heap, 1, 256, struct path_node **);
|
||||
BHEAP_PUSH2(*heap, node, NODE_MINTOPCMP, swap_ptrcast_pathnode);
|
||||
BHEAP_PUSH2(*heap, node, NODE_MINTOPCMP);
|
||||
#endif // __clang_analyzer__
|
||||
}
|
||||
|
||||
@@ -217,7 +215,7 @@ static int heap_update_node(struct node_heap *heap, struct path_node *node)
|
||||
ShowError("heap_update_node: node not found\n");
|
||||
return 1;
|
||||
}
|
||||
BHEAP_UPDATE(*heap, i, NODE_MINTOPCMP, swap_ptrcast_pathnode);
|
||||
BHEAP_UPDATE(*heap, i, NODE_MINTOPCMP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -372,7 +370,7 @@ bool path_search(struct walkpath_data *wpd, int16 m, int16 x0, int16 y0, int16 x
|
||||
}
|
||||
|
||||
current = BHEAP_PEEK(g_open_set); // Look for the lowest f_cost node in the 'open' set
|
||||
BHEAP_POP2(g_open_set, NODE_MINTOPCMP, swap_ptrcast_pathnode); // Remove it from 'open' set
|
||||
BHEAP_POP2(g_open_set, NODE_MINTOPCMP); // Remove it from 'open' set
|
||||
|
||||
x = current->x;
|
||||
y = current->y;
|
||||
|
||||
Reference in New Issue
Block a user