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


______________________________ Forward Header __________________________________
Subject: Re:  [TOTD] (maybe) purgeplay
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:
> 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:  |
     | |

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