Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Contagious spell...

Contagious spell...

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Vir   (3 posts)  Bio
Date Tue 30 Nov 2004 12:26 PM (UTC)
Message
Just to get it outta the way, I'm using:
SmaugWiz 2.02 on Win98, PII 350

Ok, so I wrote spell_plague and it seems to be working except for 1 thing. I want this spell to be contagious, so I opened update.c and added the following just above the ifcheck for IsPoisoned().

if ( ch->IsPlagued() )
{
CCharacter *victim, *v_next;
int retcode;

for ( victim = ch->GetInRoom()->first_person;
victim;
victim = v_next; )
{
v_next = ch->GetNextInRoom();

if ( !victim->IsNpc() )
{
retcode = spell_plague(gsn_plague, LEVEL_AVATAR, ch, victim);
}
}
}

The GSN and the IsPlagued() function are all set up correctly. The spell works just fine if nobody else is in the room. It does damage on each tick perfectly, displays the damage messages just fine. But as soon as somebody else is in the room over a tick, the MUD goes into an endless loop.

Problem is, it isn't the loop. I replaced the spell_plague(gsn_plague, ... line with victim->SendText("Ping.\n\r"); and it no longer crashed.

I have also tried pulling the code from inside spell_plague out and inserting it, as well as just doing victim->SetPlagued() which simply sets the AFF_PLAGUE bit. Both those ways, it goes into an endless loop again.

What am I doing wrong? :)
Top

Posted by Vir   (3 posts)  Bio
Date Reply #1 on Tue 30 Nov 2004 12:28 PM (UTC)
Message
Sorry, this line:

if ( !victim->IsNpc() )

should read:

if ( !victim->IsNpc() && !victim->IsPlagued() )
Top

Posted by Vir   (3 posts)  Bio
Date Reply #2 on Tue 30 Nov 2004 01:07 PM (UTC)
Message
Right. Well. I'm an idiot.

shoulda been victim->GetNextInRoom() instead of ch->GetNextInRoom()

*sigh*

Sorry all. Hehe.
Top

Posted by Rosko   (5 posts)  Bio
Date Reply #3 on Wed 01 Dec 2004 11:59 PM (UTC)
Message
Hi all,
I am legally blind and am using a screen reader, somehow the post new thread button isn't accessible.
So, this is unrelated to this discussion.
I have run into a serious problem with the Unknown Regions codebase.
I use to have a shell, now I am limited to using cygwin.
The problem is that when using cygwin after taking steps to make the codebase compatible with cygwin, the log directory gets filled with empty log files.
The process list shows that sleep is running, so it must be crashing.
I got the following output from GDB.



Program received signal SIGSEGV, Segmentation fault.
0x6108db8e in cygwin1!aclcheck () from /usr/bin/cygwin1.dll
(gdb)
I will eventually get a shell, I stopped paying for an account on mudmagic because I got tired of paying $16 a month before I had a playable mud.

Thanks in advance for your help.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #4 on Thu 02 Dec 2004 01:02 AM (UTC)
Message
Hi Rosko,

What do you get when you type "bt" in gdb? That will give you a backtrace of the function calls, which will let you see which functions called which starting from main and hopefully, will show where the crash is occurring. What you're seeing is a library failure due to a bad system call. Are you compiling with debugging information on, by the way? That should be a flag like -g2, -g3, -ggdb in your makefile.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,443 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.