home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
games
/
tinymud2.zip
/
UTILS.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-09-02
|
756b
|
47 lines
#include "copyright.h"
#include "db.h"
/* remove the first occurence of what in list headed by first */
dbref remove_first(dbref first, dbref what)
{
dbref prev;
/* special case if it's the first one */
if(first == what) {
return db[first].next;
} else {
/* have to find it */
DOLIST(prev, first) {
if(db[prev].next == what) {
db[prev].next = db[what].next;
return first;
}
}
return first;
}
}
int member(dbref thing, dbref list)
{
DOLIST(list, list) {
if(list == thing) return 1;
}
return 0;
}
dbref reverse(dbref list)
{
dbref newlist;
dbref rest;
newlist = NOTHING;
while(list != NOTHING) {
rest = db[list].next;
PUSH(list, newlist);
list = rest;
}
return newlist;
}