Re: [TOTD] (maybe) purgeplay

From: Angus Mezick (angus@EDGIL.CCMAIL.COMPUSERVE.COM)
Date: 04/23/98


nope, B-Search depends on the idnums being in order.  they can get out of order
in the file.  have a player delete and then recreat and then modify showplay to
display the idnum.  i had
1
2
3
90
5
6
7

--Angus

______________________________ Forward Header __________________________________
Subject: Re:  [TOTD] (maybe) purgeplay
Author:  INTERNET:CIRCLE@POST.QUEENSU.CA at CSERVE
Date:    4/22/98 7:17 PM

Angus Mezick <angus@EDGIL.CCMAIL.COMPUSERVE.COM> writes:

> I added this to the purgeplay utility to reduce the number of idnum's used.
> at the top:
[snip]
> I did this because the code seems to assume that ID nums are in sequential
> order.  seemed kind of bad to have big gaping holes in there. esp since i can
> now do a binary search by idnum on the player_table
> Anyone see any code conflicts here?

This will be a Bad Thing.  The problem here is that id nums are used
for a lot of things that have persistance over reboots -- house
ownership, posters on boards, mail recipient and sender, and maybe
more.  They're very much needed, and if an id number changes, as far
as the code is concerned, it's a different player.

However, you're mistaken -- even if there are gaps in the numbers, you
can still do binary searches.  Binary searching works even if the
numbers aren't consecutive.  The man page on bsearch (and the related
qsort) should give you the info you need to avoid having to rewrite
something already part of the C standard library :)


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST