Re: CODE: Can someone explain this to me?

From: Daniel Koepke (dkoepke@california.com)
Date: 02/16/97


On Sun, 16 Feb 1997, James Goddard wrote:

> Now, I know it's late at night and I'm getting a little bugeyed but I
> see several problems here:
> 
> 1. If obj->timer is 1, then this will set obj->timer to -1
> 2. Nothing is actually done with the object when the timer when it
> reaches 0
> 3. If I add the fix I want to add, timers can go down by as many as 3
> times per tick
> 
> Can someone please explain why this is here, what it was supposed to do,
> and what the consequences of taking it out are?

It takes 2 away from the object's timer when the person is wearing the
equipment, and 1 away from when it's in their inventory. This code does
not need to be changed from what I can see. A quick grep of the word
'maggots' (you know, the message, "A quivering horde of maggots consumes
the corpse of Nether") shows objects in the room's timer is handled in
point_update.  For equipment carried, you need to add the timer checks:

  for (i = 0; i < NUM_WEARS; i++)
    if (GET_EQ(ch, i)) {
      update_object(GET_EQ(ch, i), 2);
      if (GET_EQ(ch, i)->timer <= 0) {
        // do whatever
      }
    }

Also, you'll need to change update_object() under next_content to check
if the object's timer is <= 0 and do whatever you want. Not the most
obvious of things, I guess.


--
Daniel Koepke
dkoepke@california.com
Forgive me father, for I am sin.


+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
|    Or send 'info circle' to majordomo@cspo.queensu.ca     |
+-----------------------------------------------------------+



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