Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Couple bugs
Yesterday, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot, Yandex

Members: 0
Guests: 7
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » 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, 1:52 pm
Go to the top of the page
Go to the bottom of the page

GatewaySysop
Conjurer
GroupMembers
Posts367
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 >>