[net.sources.games] Small Fix for ATC

markv@.UUCP (Mark VandeWettering) (01/05/87)

I was annoyed that the list of planes that appears on the right half of
the screen was not sorted in alphabetical order.  I made this quick and
dirty patch to list.c to make it insertion sort the planes into the
list.  Now the waiting and plane lists are sorted by plane number,
allowing easier location of a specific plane.  I commend the author 
on his excellent game, I didn't expect it to be this easy to modify.  
Here are the context diffs, use patch to install them, then recompile.


	Mark T. VandeWettering
	University of Oregon
	markv@uoregon.uucp

-cut--cut--cut--cut--cut--cut--cut--cut--cut--cut-cut--cut--cut--cut-cut-
*** list.c	Sun Jan  4 14:09:42 1987
--- list.old.c	Sun Jan  4 13:51:03 1987
***************
*** 19,54 ****
  	LIST	*l;
  	PLANE	*p;
  {
- 	PLANE 	*q = NULL, *r = NULL;
- 
  	if (l->head == NULL) {
  		p->next = p->prev = NULL;
  		l->head = l->tail = p;
  	} else {
! 		q = l -> head;
! 
! 		while (q != NULL && q->plane_no < p->plane_no) {
! 			r = q;
! 			q = q -> next;
! 		}
! 
! 		if (q) {
! 			if (r) {
! 				p->prev = r;
! 				r->next = p;
! 				p->next = q;
! 				q->prev = p;
! 			} else {
! 				p->next = q;
! 				p->prev = NULL;
! 				q->prev = p;
! 				l->head = p;
! 			}
! 		} else {
! 			l->tail->next = p;
! 			p->prev = l->tail;
! 			l->tail = p;
! 		}
  	}
  }
  
--- 19,32 ----
  	LIST	*l;
  	PLANE	*p;
  {
  	if (l->head == NULL) {
  		p->next = p->prev = NULL;
  		l->head = l->tail = p;
  	} else {
! 		p->prev = l->tail;
! 		p->next = NULL;
! 		l->tail->next = p;
! 		l->tail = p;
  	}
  }
  
-- 
Mark VandeWettering
University of Oregon {Computer Science,Chemstores}
mark@{uoregon,chemstor}.UUCP