Re: Object damage code...

From: George (greerga@DRAGON.HAM.MUOHIO.EDU)
Date: 08/23/97


On Sat, 23 Aug 1997, Zizazat Lazuras wrote:

>I added som enice object damage code, but the portion that deals with the
>examine does not work. (Code to follow). It is nearly identicaly to code
>added to the identify spell, and that part works just dandy. Someone,
>please, what am I overlooking?

> if (IS_NPC(tmp_char) || !IS_NPC(tmp_char))
>    return;

Oh yeah, that will work. :)

> if (GET_OBJ_TSLOTS(tmp_object) == 101) {
>        sprintf(buf, "This looks indestructable!\r\n");
>        send_to_char(buf, ch);
>    return;
>        }

if (GET_OBJ_TSLOTS(tmp_object) == 101)
  spriotf(buf, "This looks indestructable!\r\n");
else if (GET_OBJ_TSLOTS(tmp_object) <= 10)
  sprintf(buf, "This looks in extremely poor condition.\r\n");
else if (GET_OBJ_TSLOTS(tmp_object) <= 20)
  sprintf(buf, "This looks in poor condition.\r\n");
...
send_to_char(buf);
return;

OR

You can make a 'const char *mesg' and just do:
mesg = "This looks indestructible\r\n";

then:
send_to_char(mesg);

That'll save the time of copying the constant string into the variable.

--
greerga@muohio.edu me@null.net | Genius may have its limitations, but stupidity
http://www.muohio.edu/~greerga | is not thus handicapped. -- Elbert Hubbard


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