Login
User Name:

Password:



Register

Forgot your password?
do_owhere recursive
Author: Khonsu
Submitted by: Khonsu
Changes list / Addchange
Author: Khonsu
Submitted by: Khonsu
6Dragons mp3 sound pack
Author: Vladaar
Submitted by: Vladaar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
Users Online
Bing, AhrefsBot, DotBot

Members: 0
Guests: 17
Stats
Files
Topics
Posts
Members
Newest Member
489
3,791
19,644
596
Elwood

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » Codebases » AFKMud Support & Development » Bug in do_zap( ), do_brandish...
Forum Rules | Mark all | Recent Posts

Bug in do_zap( ), do_brandish( )
< Newer Topic :: Older Topic > Inequality is weak vs. strict

Pages:<< prev 1 next >>
Post is unread #1 Oct 18, 2017 3:52 pm   
Go to the top of the page
Go to the bottom of the page

GatewaySysop
Conjurer
GroupMembers
Posts413
JoinedMar 7, 2005

 
Hi all,

By chance, having somewhere along the lines ported the changes to these functions from AFK to my FUSS derivative, I came upon some oddities in play testing something. Pretty sure this is a bug and not intended behavior, but by all means correct me if wrong.

In act_obj.cpp, in do_zap( ) (and do_brandish( ) is similar), you'll find this:

   if( --wand->value[2] <= 0 )   /* Modified to prevent extraction when reaching zero - Samson */
   {
      wand->value[2] = 0;  /* To prevent negative values - Samson */
      act( AT_MAGIC, "$p hums softly, but does nothing.", ch, wand, nullptr, TO_ROOM );
      act( AT_MAGIC, "$p hums softly, but does nothing.", ch, wand, nullptr, TO_CHAR );
   }


Methinks you meant to have a strict inequality there, rather than the weak one? i.e.

   if( --wand->value[2] < 0 )   /* Modified to prevent extraction when reaching zero - Samson */
   {
      wand->value[2] = 0;  /* To prevent negative values - Samson */
      act( AT_MAGIC, "$p hums softly, but does nothing.", ch, wand, nullptr, TO_ROOM );
      act( AT_MAGIC, "$p hums softly, but does nothing.", ch, wand, nullptr, TO_CHAR );
   }


Otherwise you get the message on final use, rather than on 1st attempt after it runs out of charges. I doubt that was the intent, since it makes for silly situations where you'll successfully cast a spell and then tell the user the wand does nothing?

Anyway, hope this helps someone! :alien:

Pages:<< prev 1 next >>