Update function not sending to char

Posted by Zeno on Mon 19 Jul 2004 05:55 AM — 5 posts, 12,887 views.

USA #0
In char_check, in update.c:


              if ( total_shards(ch) > 0 && !xSET_BIT(ch->act, PLR_LETHAL ) )
              {
                send_to_char( "&RYou are now lethal due to having a shard.&D\n\r", ch );
                xSET_BIT(ch->act, PLR_LETHAL );
              }


It sets the flag correctly when they have a shard, but it does not send_to_char. Why is that?
Australia Forum Administrator #1
This doesn't look right. You are using xSET_BIT to both test the bit and set it.

I suspect it is already set (somewhere else). I think you want xSET_BITS not xSET_BIT.
USA #2
Er, I don't think so. Changing either the ifcheck of setting to SET_BITS returns this error:


update.c: In function `char_check':
update.c:1491: invalid lvalue in unary `&'
make[1]: *** [update.o] Error 1
Australia Forum Administrator #3
Look, if you have this:


if ( total_shards(ch) > 0 &&         // line 1
    !xSET_BIT(ch->act, PLR_LETHAL ) )  // line 2
 {  // line 3
 send_to_char( "blah", ch ); // line 4
 xSET_BIT(ch->act, PLR_LETHAL );  // line 5
 }  // line 6


If line 5 sets the bit, then line 2 will set the bit too. I see what you mean about xSET_BITS, probably what you want is:


  if ( total_shards(ch) > 0 && !xIS_SET(ch->act, PLR_LETHAL ) )
   {
   send_to_char( "&RYou are now lethal due to having a shard.&D\n\r", ch );
   xSET_BIT(ch->act, PLR_LETHAL );
   }


USA #4
Oh, hmm, now I see. I forgot about that IS_SET. One second, let me try that.

Yeah, that worked of course. I totally forgot about IS_SET, heh.