[CODE] Serious money bug... solved?

From: Cajun (cajun@CATHOS.TELMARON.COM)
Date: 07/11/97


This message assumes that you have read the other two messages.

Okay...  Following a hunch, I started logging players' names as they log
in.  The character would put in just the name of their character in a
seperate window/session, while the active session would drop/give the gold
and rent.  As Erik said in his reply, the descriptor which is just logging
in would have the data from disk, which would include the gold just
dropped.  Now... MUDs which do not use Circle's rent system are unaffected
because the solution to the problem lies right there in the do_quit
function.  It kills off all descriptors which are dupes of the character
trying to quit.  So to solve the problem, I hope (I'll explain in a
second), all that is needed is to insert the following code into the
gen_receptionis function immediately after it checks that the character is
indeed trying to rent or cryo.  (You will also need to declare d and next_d
in the usual manner... i.e. struct descriptor_data *d, *next_d;)

  if (CMD_IS("rent") || CMD_IS("quit")) {
     /*
     * kill off all sockets connected to the same player as the one who is
     * trying to rent.  Helps to maintain sanity as well as prevent duping.
     */
    for (d = descriptor_list; d; d = next_d) {
      next_d = d->next;
      if (d == ch->desc)
        continue;
      if (d->character && (GET_IDNUM(d->character) == GET_IDNUM(ch)))
        close_socket(d);
    }

This is just the same snippit of code from the do_quit function.  I was
finally able to duplicate the bug.  As we all know, once you can do that,
you're work is 99% done.  By implementing the above code, I can no longer
duplicate it.  However, it has not had its trial by fire yet, and only time
will bear out if it works.  But I'm confident it does.

Thanks again to Erik Niese-Peterson.

Ciaos...

James Surles
AKA Bananaman, Imp of CajunMUD  (cajun.telmaron.com 6250)


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



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