Re: waking others

David Wilson <[email protected]>
Newsgroups gmane.games.devel.mud.rom
Message-ID <[email protected]>
Presumably when the character loads, ch->on is not being set, so it's
a null (or unitialized pointer) so when you try to dereference
victim->on, you segfault.

The right way to fix it would be to see if you can set ch->on when a
player loads.

The quick 'n' dirty fix is to change your if statement to 
if (!IS_NPC(ch) && !IS_NPC(victim) && victim->on!=NULL &&
IS_SET(victim->on->value[2], SLEEP_ON))

Although that may not fix the problem if victim->on isn't initialized
to NULL, or if the problem is something else entirely. A bit of GDB
output would be nice.

-David

On 4/14/05, Brinny <[email protected]> wrote:
> I added a little piece of code in to do_wake to
> prevent someone from waking another player up while
> that person is sleeping on a piece of furniture:
> 
>     if (!IS_NPC(ch) && !IS_NPC(victim) && IS_SET
> (victim->on->value[2], SLEEP_ON))
>     {
>         send_to_char("That person is far too
> comfortable to be woken up.\n\r",ch);
>         return;
>     }
> 
> It works, but when the person who is sleeping logs out
> and logs back in (still sleeping on the furniture) and
> the other character tries to wake them it crashes. I'm
> not sure what the problem is here. Maybe I need to add
> something into another function? Any help would be
> great, thanks.
> 
> Brittany.
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Small Business - Try our new resources site!
> http://smallbusiness.yahoo.com/resources/
> --
> ROM mailing list
> [email protected]
> Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>
-- 
ROM mailing list
[email protected]
Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.