User Name:


Forgot your password?
Vote for Us!
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Majestic-12, Yandex, DotBot, Vladaar

Members: 1
Guests: 3
Newest Member
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » SWFOTE FUSS Bugfix List » [Bug] Spell immunity checks a...
Forum Rules | Mark all | Recent Posts

[Bug] Spell immunity checks are not working properly
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Feb 19, 2006, 11:17 am
Go to the top of the page
Go to the bottom of the page

Black Hand
JoinedJan 1, 2002

Bug: Spell immunity checks are not working properly
Danger: Medium - Expected immunity may not work, or may report successful even when not set.
Found by: Matteo2303
Fixed by: Samson


magic.c, is_immune

Replace that function with this new one:
bool is_immune( CHAR_DATA *ch, short damtype )
   switch( damtype )
      case SD_FIRE:           return( IS_SET( ch->immune, RIS_FIRE ) );
      case SD_COLD:           return( IS_SET( ch->immune, RIS_COLD ) );
      case SD_ELECTRICITY:    return( IS_SET( ch->immune, RIS_ELECTRICITY ) );
      case SD_ENERGY:         return( IS_SET( ch->immune, RIS_ENERGY ) );
      case SD_ACID:           return( IS_SET( ch->immune, RIS_ACID ) );
      case SD_POISON:         return( IS_SET( ch->immune, RIS_POISON ) );
      case SD_DRAIN:          return( IS_SET( ch->immune, RIS_DRAIN ) );
   return FALSE;

The is_immune function checks for the immunity to types of spell damage. It is supposed to return TRUE upon a successul check, and FALSE if not. Apparently the way the original function worked the switch was able to fall through to something else and report a false positive if another immunity was present on the player. It is assumed that this could also have worked the other way. In either case, the above function fixes the issue by returning the direct result of the IS_SET macro, be it TRUE or FALSE. The above function was adapted from the AFKMud 2.0 C++ code. In addition to fixing the issue it is also visually easier to follow, and takes up fewer lines.
Pages:<< prev 1 next >>