The Dawn Of Time
The Official Forums for the Dawn Of Time Mud Codebase
 
Log in Register FAQ Memberlist Search The Dawn Of Time Forum Index Goto the Official Dawn Website

Bug in vers. R char_data loading of spell\skill\obj affects

 
Post new topic   Reply to topic    The Dawn Of Time Forum Index » 1.69r possible bug reports
View previous topic :: View next topic  
Author Message
Blackout



Joined: 16 Aug 2003
Posts: 26

PostPosted: Mon Nov 01, 2004 2:34 pm    Post subject: Bug in vers. R char_data loading of spell\skill\obj affects Reply with quote

I stumbled across this bug which makes it so that if you quit with immunities, resistances and other outleted affects from spells\skills\objs, when you log back in and your character is loaded back up the affects are listed under affects but the actual bits are unset (as shown in stat [char]). This may be fixed with the following segments being changed\added\removed.

In FILE :save.cpp

Find:
Code:

         if (!str_cmp(word, "Affect"))
         {
            AFFECT_DATA *paf=fread_affect(fp);
            paf->next       = ch->affected;
            ch->affected    = paf;
            fMatch = true;
            break;
         }


Replace it with:

Code:

         if (!str_cmp(word, "Affect"))
         {
            AFFECT_DATA *paf=fread_affect(fp);
            affect_to_char(ch, paf);
            fMatch = true;
            break;
         }


Find:
Code:

            if(o){
               obj_to_char(o, ch);
            }         


Replace it with:
Code:

            if(o){
               obj_to_char(o, ch);
               //BUG 2
               if(o->wear_loc != WEAR_NONE)
               {
                  AFFECT_DATA *paf;
                  for(paf=OBJECT_AFFECTS(o); paf; paf = paf->next )
                  {
                     if( paf->where==WHERE_OBJECTSPELL)   {
                        affect_copy_to_char( ch, paf, o->level);
                     }else{
                        if(paf->level<=ch->level){
                           affect_modify( ch, paf, true );
                        }
                     }
                  }
               }
            }   


In FILE : Handler.cpp

Find the PROTOTYPE (or DECLARATION):
Code:

void affect_copy_to_char( char_data *ch, AFFECT_DATA *paf, int objlevel );



AND:

Code:

void   affect_modify   args( ( char_data *ch, AFFECT_DATA *paf, bool fAdd ) );


And delete them both.

In FILE: Prototype.h

Find:
Code:

/**************************************************************************/
// handler.cpp


add BENEATH it:
Code:

void affect_copy_to_char( char_data *ch, AFFECT_DATA *paf, int objlevel );
void   affect_modify   args( ( char_data *ch, AFFECT_DATA *paf, bool fAdd ) );


That should fix your problems loading affects!



_________________
"I could really get around to hating you if I didn't procrastinate so much."

The Third Turning Mud -- Wheel of Time Reimagined
tangent.dune.net 5600
Shaitan, Owner/Head Implementor
Back to top
View user's profile Send private message Send e-mail
Kalahn
Codebase Developer


Joined: 18 Jan 2003
Posts: 710
Location: New Zealand

PostPosted: Fri Nov 04, 2005 6:59 am    Post subject: Reply with quote

I have started looking at the problem - nicely spotted.

Unfortunately the solution isn't as simple as the fix you have provided... for example create an object that adds +11 to the recall skill
("addskill recall 11" in oedit)... then log in an out a few times while wearing it... you will find the players recall ability will go +11 each time they log in.

When first initially looking at the problem, I started by checking what reset_char() is doing. (reset_char( ) is called on everyone when reading the MOTD. Unfortunately it obviously isn't covering the bitflags you have raised... nowhere near it actually. One problem with just adding an exception to the code for object skills is it won't necessarily correctly handle any new features, since coders are most likely unaware of the changes it could create more problems.

I have spent about 30minutes looking at the problem so far, and my current thinking is the problem should actually be addressed with an upgrade to reset_char(). We need to be able to "recreate" a character by effectively starting with the "naked" character stats, then add all the clothing/effects/etc on. This way we should be able to run reset_char() any time and always come up with the same values as a "clothed" character. This needs further research, but I suspect this will be the better way to address the problem long term... then again the effort might not be worth the work.

Hmm, I just thought, if we used reset_char(), we don't want objects "recasting" on the players upon login... so that also needs investigation... I don't know if this problem will exist in the code you submitted.

Thanks for the report and possible solution, I am interested in further discussion/testing on the issue if anyone has a view.

- Kal



_________________
Kalahn
Developer of the Dawn of Time Codebase
http://www.dawnoftime.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    The Dawn Of Time Forum Index » 1.69r possible bug reports All times are GMT + 13 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2005 phpBB Group
Theme created by Vjacheslav Trushkin