All pastes #411894 Raw Edit

Stuff

public c v1 · immutable
#411894 ·published 2007-03-27 10:58 UTC
rendered paste body
	olnode* newnode = calloc(1,sizeof(olnode));		newnode->x = x/16;	//represent in coarse view		newnode->y = y/16;	//represent in coarse view		newnode->fvalue = f;			newnode->parent = parent;		olnode* temp = head;		//Loop through the nodes of the open list to insert the new node		//at the correct position. Using a big number because we cannot		//predict a pointer would be NULL or not.		do{			agbprint("IN FOR LOOP\n");			//The list was empty			if (temp == NULL){				//Then this is the new head				head = newnode;				newnode->previous = NULL;				newnode->next = NULL;				return;			}			//If it is smaller then the head then it			//becomes the new head			else if(is_smaller(newnode,temp) == 1){				if(temp->previous == NULL){					newnode->next = temp;					newnode->previous = NULL;					temp->previous = newnode;					head = newnode;					return;				}				//else insert it before the actual temp but after				//what was the temp previous				else{					newnode->previous = temp->previous;					newnode->previous->next = newnode;					temp->previous = newnode;					newnode->next = temp;					return;				}			}			//Otherwise put it in the end of the lis			else if(temp->next == NULL){						temp->next = newnode;				newnode->previous = temp;				newnode->next = NULL;				return;			}			temp = temp->next;		}while(temp != NULL);