Re: Auction bug (it's a feature)

From: George (greerga@dragon.ham.muohio.edu)
Date: 12/09/96


On Mon, 9 Dec 1996, Eduardo Gutierrez de Oliveira wrote:

>It is not exactly a bug, but rather the lack of a check...
>
>If a user auctions something and he drops it the auction code will not
>check for it and the mud will crash, it they change what they are auction
>the same will happen.

Geez, and I thought my 7-line comment block on how to make your own
check was sufficient ;) Here's the functions I use: How it's called is
up to you.  Clip&save if you think you might use auction.c, it's not in
the .gz file on the FTP site, or if you like the codes...

---8<---8<---	Check functions I left out of auction.c so you could
		customize your method.  (Some people take the idea
		that you shouldn't be able to drop the object in the
		first place, I took the idea that it should check)

struct obj_data *check_obj(struct char_data *ch, struct obj_data *obj)
{
  struct obj_data *ch_obj;

  for (ch_obj = ch->carrying; ch_obj; ch_obj = ch_obj->next_content)
    if (ch_obj->item_number == obj->item_number)
      return ch_obj;

  return NULL;
}

struct char_data *check_ch(struct char_data *ch)
{
  register struct char_data *tch;
  extern struct char_data *character_list;

  if (!ch)
    return NULL;

  for (tch = character_list; tch; tch = tch->next)
    if (ch->pfilepos == tch->pfilepos && ch->nr == tch->nr)
      return tch;

  return NULL;
}

---8<---8<---

--
George Greer	Student Systems Co-Administrator of Dragon
greerga@muohio.edu	http://www.ham.muohio.edu/~greerga
--
Genius may have its limitations, but stupidity is not thus
handicapped.                -- Elbert Hubbard



+-----------------------------------------------------------+
| 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/18/00 PST