pathfind.c
changeset 536 03d80fecb999
parent 500 8e52f7797b48
child 679 04ca2cd69420
equal deleted inserted replaced
535:0ddbb93125d1 536:03d80fecb999
   432 
   432 
   433 #define ARR(i) tpf->stack[(i)-1]
   433 #define ARR(i) tpf->stack[(i)-1]
   434 
   434 
   435 // called after a new element was added in the queue at the last index.
   435 // called after a new element was added in the queue at the last index.
   436 // move it down to the proper position
   436 // move it down to the proper position
   437 static void inline HeapifyUp(NewTrackPathFinder *tpf)
   437 static inline void HeapifyUp(NewTrackPathFinder *tpf)
   438 {
   438 {
   439 	StackedItem si;
   439 	StackedItem si;
   440 	int i = ++tpf->nstack;
   440 	int i = ++tpf->nstack;
   441 
   441 
   442 	while (i != 1 && ARR(i).cur_length < ARR(i>>1).cur_length) {
   442 	while (i != 1 && ARR(i).cur_length < ARR(i>>1).cur_length) {
   446 		i>>=1;
   446 		i>>=1;
   447 	}
   447 	}
   448 }
   448 }
   449 
   449 
   450 // called after the element 0 was eaten. fill it with a new element
   450 // called after the element 0 was eaten. fill it with a new element
   451 static void inline HeapifyDown(NewTrackPathFinder *tpf)
   451 static inline void HeapifyDown(NewTrackPathFinder *tpf)
   452 {
   452 {
   453 	StackedItem si;
   453 	StackedItem si;
   454 	int i = 1, j;
   454 	int i = 1, j;
   455 	int n = --tpf->nstack;
   455 	int n = --tpf->nstack;
   456 
   456