Article View: net.sources.games
Article #748Small Fix for ATC
From: markv Mark VandeWettering
Date: Sun, 04 Jan 1987 22:21
Date: Sun, 04 Jan 1987 22:21
73 lines
2263 bytes
2263 bytes
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
Technical Details
Message-ID:
<289@.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-lcc!ames!ucbcad!ucbvax!hplabs!hp-pcd!!markvShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-lcc!ames!ucbcad!ucbvax!hplabs!hp-pcd!!markv From: markv@.UUCP (Mark VandeWettering) Newsgroups: net.sources.games Subject: Small Fix for ATC Message-ID: <289@.UUCP> Date: Sun, 4-Jan-87 17:21:28 EST Article-I.D.: .289 Posted: Sun Jan 4 17:21:28 1987 Date-Received: Mon, 5-Jan-87 02:43:37 EST Reply-To: markv@uoregon.UUCP (Mark VandeWettering) Distribution: world Organization: University of Oregon, Computer Science, Eugene OR Lines: 73