Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
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
Users Online
CommonCrawl, Yandex

Members: 0
Guests: 8
Stats
Files
Topics
Posts
Members
Newest Member
481
3,735
19,370
618
Micheal64X
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] The skill table is bein...
Forum Rules | Mark all | Recent Posts

[Bug] The skill table is being severely borked up on bootup
< Newer Topic :: Older Topic > AFKMud 1.75

Pages:<< prev 1 next >>
Post is unread #1 Aug 27, 2005, 11:20 am   Last edited Nov 13, 2005, 11:07 am by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

Bug: The skill table is being severely borked up on bootup
Discovered in: AFKMud 1.75
Danger: Critical - Data corruption
Found by: Moonwolf
Fixed by: Samson

---

tables.c, fread_skill

Locate:
            if( !str_cmp( word, "Affect" ) )
            {
               SMAUG_AFF *aff;
               char mod[MIL];

               CREATE( aff, SMAUG_AFF, 1 );
               aff->duration = str_dup( fread_word( fp ) );
               aff->location = fread_number( fp );
               mudstrlcpy( mod, fread_word( fp ), MIL );
               if( aff->location == APPLY_AFFECT
                || aff->location == APPLY_RESISTANT
                || aff->location == APPLY_IMMUNE
                || aff->location == APPLY_ABSORB
                || aff->location == APPLY_SUSCEPTIBLE )
                  snprintf( mod, MIL, "%d", get_aflag( mod ) );
               aff->modifier = str_dup( mod );
               aff->bitvector = fread_number( fp );
               if( !got_info )
               {
                  for( x = 0; x < 32; x++ )
                  {
                     if( IS_SET( aff->bitvector, 1 << x ) )
                     {
                        aff->bitvector = x;
                        break;
                     }
                  }
                  if( x == 32 )
                     aff->bitvector = -1;
               }
               aff->next = skill->affects;
               skill->affects = aff;
               fMatch = TRUE;
               break;
            }
            break;


Change to:
            if( !str_cmp( word, "Affect" ) )
            {
               SMAUG_AFF *aff;
               char mod[MIL];

               CREATE( aff, SMAUG_AFF, 1 );
               aff->duration = str_dup( fread_word( fp ) );
               aff->location = fread_number( fp );
               mudstrlcpy( mod, fread_word( fp ), MIL );

               if( version < 2 )
               {
                  if( version < 1 )
                  {
                     if( aff->location == APPLY_AFFECT || aff->location == APPLY_EXT_AFFECT )
                     {
                        int mvalue = atoi( mod );

                        mudstrlcpy( mod, a_flags[mvalue], MIL );
                     }
                     if( aff->location == APPLY_RESISTANT
                      || aff->location == APPLY_IMMUNE
                      || aff->location == APPLY_ABSORB
                      || aff->location == APPLY_SUSCEPTIBLE )
                     {
                        int mvalue = atoi( mod );

                        mudstrlcpy( mod, flag_string( mvalue, old_ris_flags ), MIL );
                     }
                  }
                  else
                  {
                     if( ( aff->location == APPLY_RESISTANT && is_number( mod ) )
                       || ( aff->location == APPLY_IMMUNE && is_number( mod ) )
                       || ( aff->location == APPLY_ABSORB && is_number( mod ) )
                       || ( aff->location == APPLY_SUSCEPTIBLE && is_number( mod ) ) )
                     {
                        int mvalue = atoi( mod );

                        mudstrlcpy( mod, flag_string( mvalue, old_ris_flags ), MIL );
                     }
                  }
               }

               if( aff->location == APPLY_AFFECT )
                  aff->location = APPLY_EXT_AFFECT;
               aff->modifier = str_dup( mod );
               aff->bitvector = fread_number( fp );
               if( version < 3 && aff->bitvector > -1 )
                  ++aff->bitvector;
               if( !got_info )
               {
                  for( x = 0; x < 32; ++x )
                  {
                     if( IS_SET( aff->bitvector, 1 << x ) )
                     {
                        aff->bitvector = x;
                        break;
                     }
                  }
                  if( x == 32 )
                     aff->bitvector = -1;
               }
               aff->next = skill->affects;
               skill->affects = aff;
               fMatch = TRUE;
               break;
            }
            break;


tables.c
Locate:
#define SKILLVERSION 1
/* Updated to 1 for position text - Samson 4-26-00 */


Change to:
#define SKILLVERSION 3
/* Updated to 1 for position text - Samson 4-26-00 */
/* Updated to 3 for AFF_NONE insertion - Samson 7-27-04 */


At the top of the tables.c file, below:
char *const skill_tname[] = { "unknown", "Spell", "Skill", "Weapon", "Tongue", "Herb", "Racial", "Disease", "Lore" };


Add:
char *const old_ris_flags[] = {
   "fire", "cold", "electricity", "energy", "blunt", "pierce", "slash", "acid",
   "poison", "drain", "sleep", "charm", "hold", "nonmagic", "plus1", "plus2",
   "plus3", "plus4", "plus5", "plus6", "magic", "paralysis", "good", "evil", "hack",
   "lash"
};


skills.c, do_sset

Locate:
         if( loc == APPLY_AFFECT || loc == APPLY_RESISTANT || loc == APPLY_IMMUNE || loc == APPLY_ABSORB || loc == APPLY_SUSCEPTIBLE )
         {
            int modval = get_aflag( modifier );

            /* Sanitize the flag input for the modifier if needed -- Samson */
            if( modval < 0 )
               modval = 0;
            snprintf( modifier, MIL, "%d", modval );
         }


Replace with:
         if( loc == APPLY_AFFECT || loc == APPLY_EXT_AFFECT )
         {
            int modval = get_aflag( modifier );

            /* Sanitize the flag input for the modifier if needed -- Samson */
            if( modval < 0 )
               modval = 0;
            /* Spells/skills affect people, yes? People can only have EXT_BV affects, yes? */
            if( loc == APPLY_AFFECT )
               aff->location = APPLY_EXT_AFFECT;
            mudstrlcpy( modifier, a_flags[modval], MIL );
         }
         if( loc == APPLY_RESISTANT || loc == APPLY_IMMUNE || loc == APPLY_ABSORB || loc == APPLY_SUSCEPTIBLE )
         {
            int modval = get_risflag( modifier );

            /* Sanitize the flag input for the modifier if needed -- Samson */
            if( modval < 0 )
               modval = 0;
            mudstrlcpy( modifier, ris_flags[modval], MIL );
         }


magic.c, spell_affectchar

Locate:
      af.modifier = dice_parse( ch, level, saf->modifier );
      af.location = saf->location % REVERSE_APPLY;


Change to:
      if( saf->location == APPLY_AFFECT
       || saf->location == APPLY_EXT_AFFECT )
      {
         af.modifier = saf->bitvector;
      }
      else if( saf->location == APPLY_RESISTANT
       || saf->location == APPLY_IMMUNE
       || saf->location == APPLY_ABSORB
       || saf->location == APPLY_SUSCEPTIBLE )
      {
         af.modifier = get_risflag( saf->modifier );
      }
      else
         af.modifier = dice_parse( ch, level, saf->modifier );
      af.location = saf->location % REVERSE_APPLY;


handler.c, affect_loc_name

Locate:
      case APPLY_ALLSTATS:
         return "allstats";


Below that, add:
      case APPLY_EXT_AFFECT:
         return "ext_affected";


act_wiz.c, do_mstat

There are two places for this. Locate:
      for( paf = victim->first_affect; paf; paf = paf->next )
         if( ( skill = get_skilltype( paf->type ) ) != NULL )
            ch_printf( ch, "|%s: '&G%s&w' modifies &G%s&w by &G%d&w for &G%d&w rounds with bits &G%s&w.\n\r",
                       skill_tname[skill->type], skill->name, affect_loc_name( paf->location ),
                       paf->modifier, paf->duration, a_flags[paf->bit] );


Replace with:
      for( paf = victim->first_affect; paf; paf = paf->next )
         if( ( skill = get_skilltype( paf->type ) ) != NULL )
         {
            char loc[MIL];

            if( paf->location == APPLY_AFFECT || paf->location == APPLY_EXT_AFFECT )
            {
               mudstrlcpy( loc, a_flags[paf->modifier], MIL );
            }
            else if( paf->location == APPLY_RESISTANT || paf->location == APPLY_IMMUNE || paf->location == APPLY_ABSORB || paf->location == APPLY_SUSCEPTIBLE )
            {
               mudstrlcpy( loc, ris_flags[paf->modifier], MIL );
            }
            else
               snprintf( loc, MIL, "%d", paf->modifier );
            ch_printf( ch, "|%s: '&G%s&w' modifies &G%s&w by &G%s&w for &G%d&w rounds with bits &G%s&w.\n\r",
                       skill_tname[skill->type], skill->name, a_types[paf->location],
                       loc, paf->duration, a_flags[paf->bit] );
         }


The skill table became borked in a bad way when the adjustments were made for flag updates in a previous version of the codebase. Unfortunately this was not noticed until just recently and it's taken quite a bit of time to even begin to wrap minds around the problem. Correcting all of the above locations should resolve the problems. However, there are no ironclad guarantees, and any further funkiness in the skill table should be reported immediately after this patch is applied. Once applied, your existing skill file will be parsed for correctness.
       
Pages:<< prev 1 next >>